Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libCacheSim/bin/MRC/SHARDS.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include <stdio.h>
#include <stdlib.h>
#include <time.h>
Expand Down Expand Up @@ -99,7 +99,7 @@
params->reader->init_params.sampler->sampling_ratio = 1.0;
params->reader->sampler->sampling_ratio = 1.0;
uint64_t n_req = get_num_of_req(params->reader);
printf("n_req: %" PRIu64 "\n", n_req);
printf("n_req: %lu\n", n_req);
params->reader->init_params.sampler->sampling_ratio = params->rate;
params->reader->sampler->sampling_ratio = params->rate;

Expand Down
31 changes: 11 additions & 20 deletions libCacheSim/bin/MRC/main.c
Original file line number Diff line number Diff line change
@@ -1,27 +1,23 @@
#ifdef __linux__
#include <sys/sysinfo.h>
#endif
#include <assert.h>
#include <libgen.h>
#include <unistd.h>

#include "../../include/libCacheSim/sampling.h"
#include "../cachesim/internal.h"
#include "mrc_internal.h"

int main(int argc, char **argv) {
if (argc < 5) {
fprintf(stderr,
"Usage:\n"
fprintf(stderr, "Usage:\n"
" For SHARDS:\n"
" %s SHARDS <output_file> <trace_file> <trace_type> <rate> "
"[--size SIZE] [other options]\n\n"
" %s SHARDS <output_file> <trace_file> <trace_type> <rate> [--size SIZE] [other options]\n\n"
" For MINI:\n"
" %s MINI <trace_file> <trace_type> <eviction_algo> "
"<cache_sizes> <rate> <output_file> [other options]\n",
" %s MINI <trace_file> <trace_type> <eviction_algo> <cache_sizes> <rate> <output_file> [other options]\n",
argv[0], argv[0]);
return 1;
}
}

// printf("Received Arguments:\n");
// for (int i = 0; i < argc; i++) {
Expand All @@ -31,7 +27,7 @@
char *algorithm_type = argv[1];
printf("Algorithm type: %s\n", algorithm_type);
if (strcmp(algorithm_type, "MINI") == 0) {
char *path = argv[7];
char* path=argv[7];
struct MINI_arguments arguments;
parse_mini_cmd(argc, argv, &arguments);
cache_stat_t *return_value = generate_mini_mrc(&arguments);
Expand All @@ -43,16 +39,11 @@
}

fprintf(output_file, "Cache Size,Miss Ratio, Miss Ratio Byte\n");
for (int i = 0; i < arguments.n_cache_size * arguments.n_eviction_algo;
i++) {
uint64_t cache_size = (uint64_t)((float)return_value[i].cache_size /
return_value[i].sampler_ratio);
double miss_ratio =
(double)return_value[i].n_miss / (double)return_value[i].n_req;
double miss_ratio_byte = (double)return_value[i].n_miss_byte /
(double)return_value[i].n_req_byte;
fprintf(output_file, "%" PRId64 ",%f, %f\n", cache_size, miss_ratio,
miss_ratio_byte);
for (int i = 0; i < arguments.n_cache_size * arguments.n_eviction_algo; i++) {
uint64_t cache_size = (uint64_t)((float)return_value[i].cache_size / return_value[i].sampler_ratio);
double miss_ratio = (double)return_value[i].n_miss / (double)return_value[i].n_req;
double miss_ratio_byte = (double)return_value[i].n_miss_byte / (double)return_value[i].n_req_byte;
fprintf(output_file, "%ld,%f, %f\n", cache_size, miss_ratio, miss_ratio_byte);
}

fclose(output_file);
Expand All @@ -66,4 +57,4 @@
fprintf(stderr, "Error: unknown algorithm type\n");
return 1;
}
}
}
2 changes: 1 addition & 1 deletion libCacheSim/bin/cachesim/sim.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#include "../../include/libCacheSim/cache.h"
#include "../../include/libCacheSim/reader.h"
#include "../../utils/include/mymath.h"
Expand Down Expand Up @@ -93,7 +93,7 @@
(double)req_cnt / 1000000.0 / runtime);
} else {
snprintf(output_str, 1024,
"%s %s cache size %8" PRId64 ", %16lu req, miss ratio %.4lf, throughput "
"%s %s cache size %8ld, %16lu req, miss ratio %.4lf, throughput "
"%.2lf MQPS\n",
reader->trace_path, detailed_cache_name, cache->cache_size,
(unsigned long)req_cnt, (double)miss_cnt / (double)req_cnt,
Expand Down
6 changes: 3 additions & 3 deletions libCacheSim/bin/debug/aligned.c
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@

#include <fcntl.h>
#include <stdint.h>
Expand Down Expand Up @@ -142,7 +142,7 @@
printf("uint16_t unaligned read time: %.4f sec\n", time_read_uint16_unaligned);
printf("uint8_t aligned read time: %.4f sec\n", time_read_uint8_aligned);
printf("uint8_t unaligned read time: %.4f sec\n", time_read_uint8_unaligned);
printf("s: %" PRId64 "\n", s);
printf("s: %ld\n", s);

close(fd);
}
Expand Down Expand Up @@ -264,7 +264,7 @@
printf("struct aligned read time: %.4f sec\n", time_read_struct_aligned);
printf("struct unaligned read time: %.4f sec\n", time_read_struct_unaligned);

printf("s: %" PRId64 "\n", s);
printf("s: %ld\n", s);
close(fd);
}

Expand Down Expand Up @@ -314,7 +314,7 @@
printf("struct aligned read time: %.4f sec\n", time_read_struct_aligned);
printf("struct unaligned read time: %.4f sec\n", time_read_struct_unaligned);

printf("s: %" PRId64 "\n", s);
printf("s: %ld\n", s);
}

int main(int argc, char* argv[]) {
Expand Down
2 changes: 1 addition & 1 deletion libCacheSim/bin/mrcProfiler/main.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ void print_args(struct arguments *args) {
printf("trace_type: %d\n", args->trace_type);
printf("trace_type_params: %s\n", args->trace_type_params);
printf("ofilepath: %s\n", args->ofilepath);
printf("n_req: %" PRId64 "\n", args->n_req);
printf("n_req: %ld\n", args->n_req);
printf("verbose: %d\n", args->verbose);
printf("cache_algorithm_str: %s\n", args->cache_algorithm_str);
printf("mrc_size_str: %s\n", args->mrc_size_str);
Expand Down
Loading