| 464 | } |
| 465 | |
| 466 | static void set_cache_size(struct arguments *args, reader_t *reader) { |
| 467 | #define N_AUTO_CACHE_SIZE 8 |
| 468 | // if (set_hard_code_cache_size(args)) { |
| 469 | // /* find the hard-coded cache size */ |
| 470 | // return; |
| 471 | // } |
| 472 | |
| 473 | // detect cache size from the trace |
| 474 | int n_cache_sizes = 0; |
| 475 | int64_t wss_obj = 0, wss_byte = 0; |
| 476 | cal_working_set_size(reader, &wss_obj, &wss_byte); |
| 477 | int64_t wss = args->ignore_obj_size ? wss_obj : wss_byte; |
| 478 | double s[N_AUTO_CACHE_SIZE] = {0.001, 0.003, 0.01, 0.03, 0.1, 0.2, 0.4, 0.8}; |
| 479 | for (int i = 0; i < N_AUTO_CACHE_SIZE; i++) { |
| 480 | if (args->ignore_obj_size) { |
| 481 | if ((long)(wss_obj * s[i]) > 4) { |
| 482 | args->cache_sizes[n_cache_sizes++] = (long)(wss * s[i]); |
| 483 | } |
| 484 | } else { |
| 485 | if ((long)(wss_obj * s[i]) >= 100) { |
| 486 | args->cache_sizes[n_cache_sizes++] = (long)(wss * s[i]); |
| 487 | } |
| 488 | } |
| 489 | } |
| 490 | args->n_cache_size = n_cache_sizes; |
| 491 | |
| 492 | if (args->n_cache_size == 0) { |
| 493 | printf("working set %ld too small\n", (long)wss); |
| 494 | exit(0); |
| 495 | } |
| 496 | } |
| 497 | |
| 498 | /** |
| 499 | * @brief print the parsed arguments |
no test coverage detected