MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / set_cache_size

Function set_cache_size

libCacheSim/bin/cachesim/cli_parser.c:466–496  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

464}
465
466static 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

Callers 1

conv_cache_sizesFunction · 0.85

Calls 1

cal_working_set_sizeFunction · 0.85

Tested by

no test coverage detected