diff --git a/libCacheSim/bin/cachesim/internal.h b/libCacheSim/bin/cachesim/internal.h index 115f473d..86041249 100644 --- a/libCacheSim/bin/cachesim/internal.h +++ b/libCacheSim/bin/cachesim/internal.h @@ -57,7 +57,7 @@ void parse_cmd(int argc, char *argv[], struct arguments *args); void free_arg(struct arguments *args); void simulate(reader_t *reader, cache_t *cache, int report_interval, - int warmup_sec, char *ofilepath); + int warmup_sec, char *ofilepath, bool ignore_obj_size); void print_parsed_args(struct arguments *args); diff --git a/libCacheSim/bin/cachesim/main.c b/libCacheSim/bin/cachesim/main.c index 4d1dce05..0d1605e1 100644 --- a/libCacheSim/bin/cachesim/main.c +++ b/libCacheSim/bin/cachesim/main.c @@ -22,7 +22,7 @@ int main(int argc, char **argv) { if (args.n_cache_size * args.n_eviction_algo == 1) { simulate(args.reader, args.caches[0], args.report_interval, args.warmup_sec, - args.ofilepath); + args.ofilepath, args.ignore_obj_size); free_arg(&args); return 0; @@ -54,6 +54,8 @@ int main(int argc, char **argv) { } else if (args.cache_sizes[0] > KiB) { size_unit = KiB; size_unit_str = "KiB"; + } else { + size_unit_str = "B"; } } diff --git a/libCacheSim/bin/cachesim/sim.c b/libCacheSim/bin/cachesim/sim.c index ce8ec97d..c9319f08 100644 --- a/libCacheSim/bin/cachesim/sim.c +++ b/libCacheSim/bin/cachesim/sim.c @@ -11,7 +11,7 @@ extern "C" { #endif void simulate(reader_t *reader, cache_t *cache, int report_interval, - int warmup_sec, char *ofilepath) { + int warmup_sec, char *ofilepath, bool ignore_obj_size) { /* random seed */ srand(time(NULL)); set_rand_seed(rand()); @@ -66,15 +66,25 @@ void simulate(reader_t *reader, cache_t *cache, int report_interval, char output_str[1024]; char size_str[8]; - convert_size_to_str(cache->cache_size, size_str); + if (!ignore_obj_size) + convert_size_to_str(cache->cache_size, size_str); #pragma GCC diagnostic push #pragma GCC diagnostic ignored "-Wformat-truncation" - snprintf(output_str, 1024, - "%s %s cache size %8s, %16lu req, miss ratio %.4lf, throughput " - "%.2lf MQPS\n", - reader->trace_path, cache->cache_name, size_str, - (unsigned long)req_cnt, (double)miss_cnt / (double)req_cnt, - (double)req_cnt / 1000000.0 / runtime); + if (!ignore_obj_size) { + snprintf(output_str, 1024, + "%s %s cache size %8s, %16lu req, miss ratio %.4lf, throughput " + "%.2lf MQPS\n", + reader->trace_path, cache->cache_name, size_str, + (unsigned long)req_cnt, (double)miss_cnt / (double)req_cnt, + (double)req_cnt / 1000000.0 / runtime); + } else { + snprintf(output_str, 1024, + "%s %s cache size %8ld, %16lu req, miss ratio %.4lf, throughput " + "%.2lf MQPS\n", + reader->trace_path, cache->cache_name, cache->cache_size, + (unsigned long)req_cnt, (double)miss_cnt / (double)req_cnt, + (double)req_cnt / 1000000.0 / runtime); + } #pragma GCC diagnostic pop printf("%s", output_str); diff --git a/libCacheSim/traceAnalyzer/utils/include/utilsStr.h b/libCacheSim/traceAnalyzer/utils/include/utilsStr.h index b90f1680..a604e2d1 100644 --- a/libCacheSim/traceAnalyzer/utils/include/utilsStr.h +++ b/libCacheSim/traceAnalyzer/utils/include/utilsStr.h @@ -29,7 +29,7 @@ static inline void convert_size_to_str(long long size, char *str) { } else if (size >= KiB) { sprintf(str, "%.0lf KiB", (double) size / KiB); } else { - sprintf(str, "%lld", size); + sprintf(str, "%lld B", size); } } diff --git a/libCacheSim/utils/mystr.c b/libCacheSim/utils/mystr.c index 086f698d..c37e7a89 100644 --- a/libCacheSim/utils/mystr.c +++ b/libCacheSim/utils/mystr.c @@ -27,7 +27,7 @@ void convert_size_to_str(unsigned long long size, char *str) { } else if (size >= KiB) { sprintf(str, "%.0lfKiB", (double)size / KiB); } else { - sprintf(str, "%lld", size); + sprintf(str, "%lldB", size); } }