44#include <assert.h>
55#include <libgen.h>
66#include <unistd.h>
7-
87#include "../../include/libCacheSim/sampling.h"
98#include "../cachesim/internal.h"
109#include "mrc_internal.h"
1110
1211int main (int argc , char * * argv ) {
1312 if (argc < 5 ) {
14- fprintf (stderr ,
15- "Usage:\n"
13+ fprintf (stderr , "Usage:\n"
1614 " For SHARDS:\n"
17- " %s SHARDS <output_file> <trace_file> <trace_type> <rate> "
18- "[--size SIZE] [other options]\n\n"
15+ " %s SHARDS <output_file> <trace_file> <trace_type> <rate> [--size SIZE] [other options]\n\n"
1916 " For MINI:\n"
20- " %s MINI <trace_file> <trace_type> <eviction_algo> "
21- "<cache_sizes> <rate> <output_file> [other options]\n" ,
17+ " %s MINI <trace_file> <trace_type> <eviction_algo> <cache_sizes> <rate> <output_file> [other options]\n" ,
2218 argv [0 ], argv [0 ]);
2319 return 1 ;
24- }
20+ }
2521
2622 // printf("Received Arguments:\n");
2723 // for (int i = 0; i < argc; i++) {
@@ -31,7 +27,7 @@ int main(int argc, char **argv) {
3127 char * algorithm_type = argv [1 ];
3228 printf ("Algorithm type: %s\n" , algorithm_type );
3329 if (strcmp (algorithm_type , "MINI" ) == 0 ) {
34- char * path = argv [7 ];
30+ char * path = argv [7 ];
3531 struct MINI_arguments arguments ;
3632 parse_mini_cmd (argc , argv , & arguments );
3733 cache_stat_t * return_value = generate_mini_mrc (& arguments );
@@ -43,16 +39,11 @@ int main(int argc, char **argv) {
4339 }
4440
4541 fprintf (output_file , "Cache Size,Miss Ratio, Miss Ratio Byte\n" );
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 );
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 );
5647 }
5748
5849 fclose (output_file );
@@ -66,4 +57,4 @@ int main(int argc, char **argv) {
6657 fprintf (stderr , "Error: unknown algorithm type\n" );
6758 return 1 ;
6859 }
69- }
60+ }
0 commit comments