1212extern "C" {
1313#endif
1414
15- static inline cache_t * create_cache (const char * trace_path , const char * eviction_algo , const uint64_t cache_size ,
16- const char * eviction_params , const bool consider_obj_metadata ) {
15+ static inline cache_t * create_cache (const char * trace_path ,
16+ const char * eviction_algo ,
17+ const uint64_t cache_size ,
18+ const char * eviction_params ,
19+ const bool consider_obj_metadata ) {
1720 common_cache_params_t cc_params = {
18- .cache_size = cache_size ,
19- .default_ttl = 86400 * 300 ,
20- .hashpower = 24 ,
21- .consider_obj_metadata = consider_obj_metadata ,
22- };
21+ .cache_size = cache_size ,
22+ .default_ttl = 86400 * 300 ,
23+ .hashpower = 24 ,
24+ .consider_obj_metadata = consider_obj_metadata ,
25+ };
2326 cache_t * cache ;
2427
2528 /* the trace provided is small */
26- if (trace_path != NULL && strstr (trace_path , "data/trace." ) != NULL ) cc_params .hashpower -= 8 ;
29+ if (trace_path != NULL && strstr (trace_path , "data/trace." ) != NULL )
30+ cc_params .hashpower -= 8 ;
2731
2832 if (strcasecmp (eviction_algo , "lru" ) == 0 ) {
2933 cache = LRU_init (cc_params , eviction_params );
@@ -45,7 +49,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
4549 cache = GDSF_init (cc_params , eviction_params );
4650 } else if (strcasecmp (eviction_algo , "lfuda" ) == 0 ) {
4751 cache = LFUDA_init (cc_params , eviction_params );
48- } else if (strcasecmp (eviction_algo , "twoq" ) == 0 || strcasecmp (eviction_algo , "2q" ) == 0 ) {
52+ } else if (strcasecmp (eviction_algo , "twoq" ) == 0 ||
53+ strcasecmp (eviction_algo , "2q" ) == 0 ) {
4954 cache = TwoQ_init (cc_params , eviction_params );
5055 } else if (strcasecmp (eviction_algo , "slru" ) == 0 ) {
5156 cache = SLRU_init (cc_params , eviction_params );
@@ -81,7 +86,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
8186 }
8287 } else if (strcasecmp (eviction_algo , "wtinyLFU" ) == 0 ) {
8388 cache = WTinyLFU_init (cc_params , eviction_params );
84- } else if (strcasecmp (eviction_algo , "belady" ) == 0 && strcasestr (trace_path , "lcs" ) == NULL ) {
89+ } else if (strcasecmp (eviction_algo , "belady" ) == 0 &&
90+ strcasestr (trace_path , "lcs" ) == NULL ) {
8591 if (strcasestr (trace_path , "oracleGeneral" ) == NULL ) {
8692 WARN ("belady is only supported for oracleGeneral and lcs trace\n" );
8793 WARN ("to convert a trace to lcs format\n" );
@@ -93,7 +99,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
9399 } else if (strcasecmp (eviction_algo , "nop" ) == 0 ) {
94100 cache = nop_init (cc_params , eviction_params );
95101 } else if (strcasecmp (eviction_algo , "beladySize" ) == 0 ) {
96- if (strcasestr (trace_path , "oracleGeneral" ) == NULL && strcasestr (trace_path , "lcs" ) == NULL ) {
102+ if (strcasestr (trace_path , "oracleGeneral" ) == NULL &&
103+ strcasestr (trace_path , "lcs" ) == NULL ) {
97104 WARN ("beladySize is only supported for oracleGeneral and lcs trace\n" );
98105 WARN ("to convert a trace to lcs format\n" );
99106 WARN ("./bin/traceConv input_trace trace_format output_trace\n" );
@@ -102,14 +109,16 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
102109 }
103110 cc_params .hashpower = MAX (cc_params .hashpower - 8 , 16 );
104111 cache = BeladySize_init (cc_params , eviction_params );
105- } else if (strcasecmp (eviction_algo , "fifo-reinsertion" ) == 0 || strcasecmp (eviction_algo , "clock" ) == 0 ||
112+ } else if (strcasecmp (eviction_algo , "fifo-reinsertion" ) == 0 ||
113+ strcasecmp (eviction_algo , "clock" ) == 0 ||
106114 strcasecmp (eviction_algo , "second-chance" ) == 0 ) {
107115 cache = Clock_init (cc_params , eviction_params );
108116 } else if (strcasecmp (eviction_algo , "clockpro" ) == 0 ) {
109117 cache = ClockPro_init (cc_params , eviction_params );
110118 } else if (strcasecmp (eviction_algo , "lirs" ) == 0 ) {
111119 cache = LIRS_init (cc_params , eviction_params );
112- } else if (strcasecmp (eviction_algo , "fifomerge" ) == 0 || strcasecmp (eviction_algo , "fifo-merge" ) == 0 ) {
120+ } else if (strcasecmp (eviction_algo , "fifomerge" ) == 0 ||
121+ strcasecmp (eviction_algo , "fifo-merge" ) == 0 ) {
113122 cache = FIFO_Merge_init (cc_params , eviction_params );
114123 // } else if (strcasecmp(eviction_algo, "fifo-reinsertion") == 0) {
115124 // cache = FIFO_Reinsertion_init(cc_params, eviction_params);
@@ -130,15 +139,17 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
130139 cache = Sieve_Belady_init (cc_params , eviction_params );
131140 } else if (strcasecmp (eviction_algo , "s3lru" ) == 0 ) {
132141 cache = S3LRU_init (cc_params , eviction_params );
133- } else if (strcasecmp (eviction_algo , "s3fifo" ) == 0 || strcasecmp (eviction_algo , "s3-fifo" ) == 0 ) {
142+ } else if (strcasecmp (eviction_algo , "s3fifo" ) == 0 ||
143+ strcasecmp (eviction_algo , "s3-fifo" ) == 0 ) {
134144 cache = S3FIFO_init (cc_params , eviction_params );
135- } else if (strcasecmp (eviction_algo , "s3fifov0" ) == 0 || strcasecmp (eviction_algo , "s3-fifov0" ) == 0 ) {
145+ } else if (strcasecmp (eviction_algo , "s3fifov0" ) == 0 ||
146+ strcasecmp (eviction_algo , "s3-fifov0" ) == 0 ) {
136147 cache = S3FIFOv0_init (cc_params , eviction_params );
137148 } else if (strcasecmp (eviction_algo , "s3fifod" ) == 0 ) {
138149 cache = S3FIFOd_init (cc_params , eviction_params );
139150 } else if (strcasecmp (eviction_algo , "qdlp" ) == 0 ) {
140151 cache = QDLP_init (cc_params , eviction_params );
141- } else if (strcasecmp (eviction_algo , "CAR" ) == 0 ) {
152+ } else if (strcasecmp (eviction_algo , "CAR" ) == 0 ) {
142153 cache = CAR_init (cc_params , eviction_params );
143154 } else if (strcasecmp (eviction_algo , "sieve" ) == 0 ) {
144155 cache = Sieve_init (cc_params , eviction_params );
@@ -147,28 +158,13 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction
147158 cache = ThreeLCache_init (cc_params , eviction_params );
148159#endif
149160#ifdef ENABLE_GLCACHE
150- } else if (strcasecmp (eviction_algo , "GLCache" ) == 0 || strcasecmp (eviction_algo , "gl-cache" ) == 0 ) {
161+ } else if (strcasecmp (eviction_algo , "GLCache" ) == 0 ||
162+ strcasecmp (eviction_algo , "gl-cache" ) == 0 ) {
151163 cache = GLCache_init (cc_params , eviction_params );
152164#endif
153165#ifdef ENABLE_LRB
154166 } else if (strcasecmp (eviction_algo , "lrb" ) == 0 ) {
155167 cache = LRB_init (cc_params , eviction_params );
156- #endif
157- #ifdef INCLUDE_PRIV
158- } else if (strcasecmp (eviction_algo , "mclock" ) == 0 ) {
159- cache = MClock_init (cc_params , eviction_params );
160- } else if (strcasecmp (eviction_algo , "lp-sfifo" ) == 0 ) {
161- cache = LP_SFIFO_init (cc_params , eviction_params );
162- } else if (strcasecmp (eviction_algo , "lp-arc" ) == 0 ) {
163- cache = LP_ARC_init (cc_params , eviction_params );
164- } else if (strcasecmp (eviction_algo , "lp-twoq" ) == 0 ) {
165- cache = LP_TwoQ_init (cc_params , eviction_params );
166- } else if (strcasecmp (eviction_algo , "qdlpv0" ) == 0 ) {
167- cache = QDLPv0_init (cc_params , eviction_params );
168- } else if (strcasecmp (eviction_algo , "s3fifodv2" ) == 0 ) {
169- cache = S3FIFOdv2_init (cc_params , eviction_params );
170- } else if (strcasecmp (eviction_algo , "myMQv1" ) == 0 ) {
171- cache = myMQv1_init (cc_params , eviction_params );
172168#endif
173169 } else {
174170 ERROR ("do not support algorithm %s\n" , eviction_algo );
0 commit comments