44#include <assert.h>
55#include <libgen.h>
66#include <unistd.h>
7+
78#include "../../include/libCacheSim/sampling.h"
89#include "../cachesim/internal.h"
910#include "mrc_internal.h"
1011
1112int main (int argc , char * * argv ) {
1213 if (argc < 5 ) {
13- fprintf (stderr , "Usage:\n"
14+ fprintf (stderr ,
15+ "Usage:\n"
1416 " For SHARDS:\n"
15- " %s SHARDS <output_file> <trace_file> <trace_type> <rate> [--size SIZE] [other options]\n\n"
17+ " %s SHARDS <output_file> <trace_file> <trace_type> <rate> "
18+ "[--size SIZE] [other options]\n\n"
1619 " For MINI:\n"
17- " %s MINI <trace_file> <trace_type> <eviction_algo> <cache_sizes> <rate> <output_file> [other options]\n" ,
20+ " %s MINI <trace_file> <trace_type> <eviction_algo> "
21+ "<cache_sizes> <rate> <output_file> [other options]\n" ,
1822 argv [0 ], argv [0 ]);
1923 return 1 ;
20- }
24+ }
2125
2226 // printf("Received Arguments:\n");
2327 // for (int i = 0; i < argc; i++) {
@@ -27,7 +31,7 @@ int main(int argc, char **argv) {
2731 char * algorithm_type = argv [1 ];
2832 printf ("Algorithm type: %s\n" , algorithm_type );
2933 if (strcmp (algorithm_type , "MINI" ) == 0 ) {
30- char * path = argv [7 ];
34+ char * path = argv [7 ];
3135 struct MINI_arguments arguments ;
3236 parse_mini_cmd (argc , argv , & arguments );
3337 cache_stat_t * return_value = generate_mini_mrc (& arguments );
@@ -39,11 +43,16 @@ int main(int argc, char **argv) {
3943 }
4044
4145 fprintf (output_file , "Cache Size,Miss Ratio, Miss Ratio Byte\n" );
42- for (int i = 0 ; i < arguments .n_cache_size * arguments .n_eviction_algo ; i ++ ) {
43- uint64_t cache_size = (uint64_t )((float )return_value [i ].cache_size / return_value [i ].sampler_ratio );
44- double miss_ratio = (double )return_value [i ].n_miss / (double )return_value [i ].n_req ;
45- double miss_ratio_byte = (double )return_value [i ].n_miss_byte / (double )return_value [i ].n_req_byte ;
46- fprintf (output_file , "%ld,%f, %f\n" , cache_size , miss_ratio , miss_ratio_byte );
46+ for (int i = 0 ; i < arguments .n_cache_size * arguments .n_eviction_algo ;
47+ i ++ ) {
48+ uint64_t cache_size = (uint64_t )((float )return_value [i ].cache_size /
49+ return_value [i ].sampler_ratio );
50+ double miss_ratio =
51+ (double )return_value [i ].n_miss / (double )return_value [i ].n_req ;
52+ double miss_ratio_byte = (double )return_value [i ].n_miss_byte /
53+ (double )return_value [i ].n_req_byte ;
54+ fprintf (output_file , "%" PRId64 ",%f, %f\n" , cache_size , miss_ratio ,
55+ miss_ratio_byte );
4756 }
4857
4958 fclose (output_file );
@@ -57,4 +66,4 @@ int main(int argc, char **argv) {
5766 fprintf (stderr , "Error: unknown algorithm type\n" );
5867 return 1 ;
5968 }
60- }
69+ }
0 commit comments