From 04f24e0680ceb1188aac027abebd57d6efa16f2a Mon Sep 17 00:00:00 2001 From: Laura Stampf Date: Wed, 18 Jun 2025 17:35:32 +0200 Subject: [PATCH 1/4] Refactor cache_init.h for better extensibility --- libCacheSim/bin/cachesim/cache_init.h | 145 +++++++++++--------------- 1 file changed, 63 insertions(+), 82 deletions(-) diff --git a/libCacheSim/bin/cachesim/cache_init.h b/libCacheSim/bin/cachesim/cache_init.h index f3a82216..4f360bc0 100644 --- a/libCacheSim/bin/cachesim/cache_init.h +++ b/libCacheSim/bin/cachesim/cache_init.h @@ -24,48 +24,73 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction /* the trace provided is small */ if (trace_path != NULL && strstr(trace_path, "data/trace.") != NULL) cc_params.hashpower -= 8; + typedef struct { + const char *name; + cache_t *(*init_func)(common_cache_params_t, const char *); + } eviction_algo_entry_t; - if (strcasecmp(eviction_algo, "lru") == 0) { - cache = LRU_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "fifo") == 0) { - cache = FIFO_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "arc") == 0) { - cache = ARC_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "arcv0") == 0) { - cache = ARCv0_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lhd") == 0) { - cache = LHD_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "random") == 0) { - cache = Random_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "randomTwo") == 0) { - cache = RandomTwo_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lfu") == 0) { - cache = LFU_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "gdsf") == 0) { - cache = GDSF_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lfuda") == 0) { - cache = LFUDA_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "twoq") == 0 || strcasecmp(eviction_algo, "2q") == 0) { - cache = TwoQ_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "slru") == 0) { - cache = SLRU_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "slruv0") == 0) { - cache = SLRUv0_init(cc_params, eviction_params); + static const eviction_algo_entry_t simple_algos[] = { + {"lru", LRU_init}, + {"fifo", FIFO_init}, + {"arc", ARC_init}, + {"arcv0", ARCv0_init}, + {"lhd", LHD_init}, + {"random", Random_init}, + {"randomTwo", RandomTwo_init}, + {"lfu", LFU_init}, + {"gdsf", GDSF_init}, + {"lfuda", LFUDA_init}, + {"twoq", TwoQ_init}, + {"2q", TwoQ_init}, + {"slru", SLRU_init}, + {"slruv0", SLRUv0_init}, + {"lecar", LeCaR_init}, + {"lecarv0", LeCaRv0_init}, + {"RandomLRU", RandomLRU_init}, + {"cacheus", Cacheus_init}, + {"size", Size_init}, + {"lfucpp", LFUCpp_init}, + {"wtinyLFU", WTinyLFU_init}, + {"nop", nop_init}, + {"fifo-reinsertion", Clock_init}, + {"clock", Clock_init}, + {"second-chance", Clock_init}, + {"clockpro", ClockPro_init}, + {"lirs", LIRS_init}, + {"fifomerge", FIFO_Merge_init}, + {"fifo-merge", FIFO_Merge_init}, + {"flashProb", flashProb_init}, + {"sfifo", SFIFO_init}, + {"sfifov0", SFIFOv0_init}, + {"lru-prob", LRU_Prob_init}, + {"fifo-belady", FIFO_Belady_init}, + {"lru-belady", LRU_Belady_init}, + {"sieve-belady", Sieve_Belady_init}, + {"s3lru", S3LRU_init}, + {"s3fifo", S3FIFO_init}, + {"s3-fifo", S3FIFO_init}, + {"s3fifov0", S3FIFOv0_init}, + {"s3-fifov0", S3FIFOv0_init}, + {"s3fifod", S3FIFOd_init}, + {"qdlp", QDLP_init}, + {"CAR", CAR_init}, + {"sieve", Sieve_init}, + }; + + cache_t *(*init_func)(common_cache_params_t, const char *) = NULL; + for (size_t i = 0; i < sizeof(simple_algos) / sizeof(simple_algos[0]); ++i) { + if (strcasecmp(eviction_algo, simple_algos[i].name) == 0) { + init_func = simple_algos[i].init_func; + break; + } + } + + // Initializing for algorithms which require special handling (not in simple_algos) + if (init_func) { + cache = init_func(cc_params, eviction_params); } else if (strcasecmp(eviction_algo, "hyperbolic") == 0) { cc_params.hashpower = MAX(cc_params.hashpower - 8, 16); cache = Hyperbolic_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lecar") == 0) { - cache = LeCaR_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lecarv0") == 0) { - cache = LeCaRv0_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "RandomLRU") == 0) { - cache = RandomLRU_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "cacheus") == 0) { - cache = Cacheus_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "size") == 0) { - cache = Size_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lfucpp") == 0) { - cache = LFUCpp_init(cc_params, eviction_params); } else if (strcasecmp(eviction_algo, "tinyLFU") == 0) { if (eviction_params == NULL) { cache = WTinyLFU_init(cc_params, eviction_params); @@ -79,8 +104,6 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction cache = WTinyLFU_init(cc_params, eviction_params); } } - } else if (strcasecmp(eviction_algo, "wtinyLFU") == 0) { - cache = WTinyLFU_init(cc_params, eviction_params); } else if (strcasecmp(eviction_algo, "belady") == 0 && strcasestr(trace_path, "lcs") == NULL) { if (strcasestr(trace_path, "oracleGeneral") == NULL) { WARN("belady is only supported for oracleGeneral and lcs trace\n"); @@ -90,8 +113,6 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction exit(1); } cache = Belady_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "nop") == 0) { - cache = nop_init(cc_params, eviction_params); } else if (strcasecmp(eviction_algo, "beladySize") == 0) { if (strcasestr(trace_path, "oracleGeneral") == NULL && strcasestr(trace_path, "lcs") == NULL) { WARN("beladySize is only supported for oracleGeneral and lcs trace\n"); @@ -102,46 +123,6 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction } cc_params.hashpower = MAX(cc_params.hashpower - 8, 16); cache = BeladySize_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "fifo-reinsertion") == 0 || strcasecmp(eviction_algo, "clock") == 0 || - strcasecmp(eviction_algo, "second-chance") == 0) { - cache = Clock_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "clockpro") == 0) { - cache = ClockPro_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lirs") == 0) { - cache = LIRS_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "fifomerge") == 0 || strcasecmp(eviction_algo, "fifo-merge") == 0) { - cache = FIFO_Merge_init(cc_params, eviction_params); - // } else if (strcasecmp(eviction_algo, "fifo-reinsertion") == 0) { - // cache = FIFO_Reinsertion_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "flashProb") == 0) { - // used to measure application level write amp - cache = flashProb_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "sfifo") == 0) { - cache = SFIFO_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "sfifov0") == 0) { - cache = SFIFOv0_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lru-prob") == 0) { - cache = LRU_Prob_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "fifo-belady") == 0) { - cache = FIFO_Belady_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lru-belady") == 0) { - cache = LRU_Belady_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "sieve-belady") == 0) { - cache = Sieve_Belady_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "s3lru") == 0) { - cache = S3LRU_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "s3fifo") == 0 || strcasecmp(eviction_algo, "s3-fifo") == 0) { - cache = S3FIFO_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "s3fifov0") == 0 || strcasecmp(eviction_algo, "s3-fifov0") == 0) { - cache = S3FIFOv0_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "s3fifod") == 0) { - cache = S3FIFOd_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "qdlp") == 0) { - cache = QDLP_init(cc_params, eviction_params); - } else if(strcasecmp(eviction_algo, "CAR") == 0) { - cache = CAR_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "sieve") == 0) { - cache = Sieve_init(cc_params, eviction_params); #ifdef ENABLE_3L_CACHE } else if (strcasecmp(eviction_algo, "3LCache") == 0) { cache = ThreeLCache_init(cc_params, eviction_params); From 553b5f2d55d23a87329734830cc80e85341ad8dd Mon Sep 17 00:00:00 2001 From: Laura Stampf Date: Fri, 20 Jun 2025 22:18:18 +0200 Subject: [PATCH 2/4] Reformated cache_init.h using clang format --- libCacheSim/bin/cachesim/cache_init.h | 32 +++++++++++++++++---------- 1 file changed, 20 insertions(+), 12 deletions(-) diff --git a/libCacheSim/bin/cachesim/cache_init.h b/libCacheSim/bin/cachesim/cache_init.h index 4f360bc0..1ab7296c 100644 --- a/libCacheSim/bin/cachesim/cache_init.h +++ b/libCacheSim/bin/cachesim/cache_init.h @@ -12,18 +12,22 @@ extern "C" { #endif -static inline cache_t *create_cache(const char *trace_path, const char *eviction_algo, const uint64_t cache_size, - const char *eviction_params, const bool consider_obj_metadata) { +static inline cache_t *create_cache(const char *trace_path, + const char *eviction_algo, + const uint64_t cache_size, + const char *eviction_params, + const bool consider_obj_metadata) { common_cache_params_t cc_params = { - .cache_size = cache_size, - .default_ttl = 86400 * 300, - .hashpower = 24, - .consider_obj_metadata = consider_obj_metadata, -}; + .cache_size = cache_size, + .default_ttl = 86400 * 300, + .hashpower = 24, + .consider_obj_metadata = consider_obj_metadata, + }; cache_t *cache; /* the trace provided is small */ - if (trace_path != NULL && strstr(trace_path, "data/trace.") != NULL) cc_params.hashpower -= 8; + if (trace_path != NULL && strstr(trace_path, "data/trace.") != NULL) + cc_params.hashpower -= 8; typedef struct { const char *name; cache_t *(*init_func)(common_cache_params_t, const char *); @@ -85,7 +89,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction } } - // Initializing for algorithms which require special handling (not in simple_algos) + // Initializing for algorithms which require special handling (not in + // simple_algos) if (init_func) { cache = init_func(cc_params, eviction_params); } else if (strcasecmp(eviction_algo, "hyperbolic") == 0) { @@ -104,7 +109,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction cache = WTinyLFU_init(cc_params, eviction_params); } } - } else if (strcasecmp(eviction_algo, "belady") == 0 && strcasestr(trace_path, "lcs") == NULL) { + } else if (strcasecmp(eviction_algo, "belady") == 0 && + strcasestr(trace_path, "lcs") == NULL) { if (strcasestr(trace_path, "oracleGeneral") == NULL) { WARN("belady is only supported for oracleGeneral and lcs trace\n"); WARN("to convert a trace to lcs format\n"); @@ -114,7 +120,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction } cache = Belady_init(cc_params, eviction_params); } else if (strcasecmp(eviction_algo, "beladySize") == 0) { - if (strcasestr(trace_path, "oracleGeneral") == NULL && strcasestr(trace_path, "lcs") == NULL) { + if (strcasestr(trace_path, "oracleGeneral") == NULL && + strcasestr(trace_path, "lcs") == NULL) { WARN("beladySize is only supported for oracleGeneral and lcs trace\n"); WARN("to convert a trace to lcs format\n"); WARN("./bin/traceConv input_trace trace_format output_trace\n"); @@ -128,7 +135,8 @@ static inline cache_t *create_cache(const char *trace_path, const char *eviction cache = ThreeLCache_init(cc_params, eviction_params); #endif #ifdef ENABLE_GLCACHE - } else if (strcasecmp(eviction_algo, "GLCache") == 0 || strcasecmp(eviction_algo, "gl-cache") == 0) { + } else if (strcasecmp(eviction_algo, "GLCache") == 0 || + strcasecmp(eviction_algo, "gl-cache") == 0) { cache = GLCache_init(cc_params, eviction_params); #endif #ifdef ENABLE_LRB From 04ec167f84c5ba22592a1fb423b69554ea6cee4a Mon Sep 17 00:00:00 2001 From: Laura Stampf Date: Sat, 21 Jun 2025 16:11:40 +0200 Subject: [PATCH 3/4] Added 3LCache, LRB, GLCache, and PRIV into jump table --- libCacheSim/bin/cachesim/cache_init.h | 141 ++++++++++++-------------- 1 file changed, 65 insertions(+), 76 deletions(-) diff --git a/libCacheSim/bin/cachesim/cache_init.h b/libCacheSim/bin/cachesim/cache_init.h index 1ab7296c..77e3ac8d 100644 --- a/libCacheSim/bin/cachesim/cache_init.h +++ b/libCacheSim/bin/cachesim/cache_init.h @@ -34,54 +34,72 @@ static inline cache_t *create_cache(const char *trace_path, } eviction_algo_entry_t; static const eviction_algo_entry_t simple_algos[] = { - {"lru", LRU_init}, - {"fifo", FIFO_init}, - {"arc", ARC_init}, - {"arcv0", ARCv0_init}, - {"lhd", LHD_init}, - {"random", Random_init}, - {"randomTwo", RandomTwo_init}, - {"lfu", LFU_init}, - {"gdsf", GDSF_init}, - {"lfuda", LFUDA_init}, - {"twoq", TwoQ_init}, - {"2q", TwoQ_init}, - {"slru", SLRU_init}, - {"slruv0", SLRUv0_init}, - {"lecar", LeCaR_init}, - {"lecarv0", LeCaRv0_init}, - {"RandomLRU", RandomLRU_init}, - {"cacheus", Cacheus_init}, - {"size", Size_init}, - {"lfucpp", LFUCpp_init}, - {"wtinyLFU", WTinyLFU_init}, - {"nop", nop_init}, - {"fifo-reinsertion", Clock_init}, - {"clock", Clock_init}, - {"second-chance", Clock_init}, - {"clockpro", ClockPro_init}, - {"lirs", LIRS_init}, - {"fifomerge", FIFO_Merge_init}, - {"fifo-merge", FIFO_Merge_init}, - {"flashProb", flashProb_init}, - {"sfifo", SFIFO_init}, - {"sfifov0", SFIFOv0_init}, - {"lru-prob", LRU_Prob_init}, - {"fifo-belady", FIFO_Belady_init}, - {"lru-belady", LRU_Belady_init}, - {"sieve-belady", Sieve_Belady_init}, - {"s3lru", S3LRU_init}, - {"s3fifo", S3FIFO_init}, - {"s3-fifo", S3FIFO_init}, - {"s3fifov0", S3FIFOv0_init}, - {"s3-fifov0", S3FIFOv0_init}, - {"s3fifod", S3FIFOd_init}, - {"qdlp", QDLP_init}, - {"CAR", CAR_init}, - {"sieve", Sieve_init}, - }; + {"lru", LRU_init}, + {"fifo", FIFO_init}, + {"arc", ARC_init}, + {"arcv0", ARCv0_init}, + {"lhd", LHD_init}, + {"random", Random_init}, + {"randomTwo", RandomTwo_init}, + {"lfu", LFU_init}, + {"gdsf", GDSF_init}, + {"lfuda", LFUDA_init}, + {"twoq", TwoQ_init}, + {"2q", TwoQ_init}, + {"slru", SLRU_init}, + {"slruv0", SLRUv0_init}, + {"lecar", LeCaR_init}, + {"lecarv0", LeCaRv0_init}, + {"RandomLRU", RandomLRU_init}, + {"cacheus", Cacheus_init}, + {"size", Size_init}, + {"lfucpp", LFUCpp_init}, + {"wtinyLFU", WTinyLFU_init}, + {"nop", nop_init}, + {"fifo-reinsertion", Clock_init}, + {"clock", Clock_init}, + {"second-chance", Clock_init}, + {"clockpro", ClockPro_init}, + {"lirs", LIRS_init}, + {"fifomerge", FIFO_Merge_init}, + {"fifo-merge", FIFO_Merge_init}, + {"flashProb", flashProb_init}, + {"sfifo", SFIFO_init}, + {"sfifov0", SFIFOv0_init}, + {"lru-prob", LRU_Prob_init}, + {"fifo-belady", FIFO_Belady_init}, + {"lru-belady", LRU_Belady_init}, + {"sieve-belady", Sieve_Belady_init}, + {"s3lru", S3LRU_init}, + {"s3fifo", S3FIFO_init}, + {"s3-fifo", S3FIFO_init}, + {"s3fifov0", S3FIFOv0_init}, + {"s3-fifov0", S3FIFOv0_init}, + {"s3fifod", S3FIFOd_init}, + {"qdlp", QDLP_init}, + {"CAR", CAR_init}, +#ifdef ENABLE_3L_CACHE + {"3LCache", ThreeLCache_init}, +#endif +#ifdef ENABLE_GLCACHE + {"GLCache", GLCache_init}, + {"gl-cache", GLCache_init}, +#endif +#ifdef ENABLE_LRB + {"lrb", LRB_init}, +#endif +#ifdef INCLUDE_PRIV + {"mclock", MClock_init}, + {"lp-sfifo", LP_SFIFO_init}, + {"lp-arc", LP_ARC_init}, + {"lp-twoq", LP_TwoQ_init}, + {"qdlpv0", QDLPv0_init}, + {"s3fifodv2", S3FIFOdv2_init}, + {"myMQv1", myMQv1_init} +#endif +}; - cache_t *(*init_func)(common_cache_params_t, const char *) = NULL; + cache_t * (*init_func)(common_cache_params_t, const char *) = NULL; for (size_t i = 0; i < sizeof(simple_algos) / sizeof(simple_algos[0]); ++i) { if (strcasecmp(eviction_algo, simple_algos[i].name) == 0) { init_func = simple_algos[i].init_func; @@ -130,35 +148,6 @@ static inline cache_t *create_cache(const char *trace_path, } cc_params.hashpower = MAX(cc_params.hashpower - 8, 16); cache = BeladySize_init(cc_params, eviction_params); -#ifdef ENABLE_3L_CACHE - } else if (strcasecmp(eviction_algo, "3LCache") == 0) { - cache = ThreeLCache_init(cc_params, eviction_params); -#endif -#ifdef ENABLE_GLCACHE - } else if (strcasecmp(eviction_algo, "GLCache") == 0 || - strcasecmp(eviction_algo, "gl-cache") == 0) { - cache = GLCache_init(cc_params, eviction_params); -#endif -#ifdef ENABLE_LRB - } else if (strcasecmp(eviction_algo, "lrb") == 0) { - cache = LRB_init(cc_params, eviction_params); -#endif -#ifdef INCLUDE_PRIV - } else if (strcasecmp(eviction_algo, "mclock") == 0) { - cache = MClock_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lp-sfifo") == 0) { - cache = LP_SFIFO_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lp-arc") == 0) { - cache = LP_ARC_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "lp-twoq") == 0) { - cache = LP_TwoQ_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "qdlpv0") == 0) { - cache = QDLPv0_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "s3fifodv2") == 0) { - cache = S3FIFOdv2_init(cc_params, eviction_params); - } else if (strcasecmp(eviction_algo, "myMQv1") == 0) { - cache = myMQv1_init(cc_params, eviction_params); -#endif } else { ERROR("do not support algorithm %s\n", eviction_algo); abort(); From a9746642eca8a4ca04d3ca873c77ad3338ebc7c6 Mon Sep 17 00:00:00 2001 From: Laura Stampf Date: Sat, 21 Jun 2025 16:19:57 +0200 Subject: [PATCH 4/4] Reformat with clang format --- libCacheSim/bin/cachesim/cache_init.h | 114 +++++++++++++------------- 1 file changed, 57 insertions(+), 57 deletions(-) diff --git a/libCacheSim/bin/cachesim/cache_init.h b/libCacheSim/bin/cachesim/cache_init.h index 77e3ac8d..339e9efc 100644 --- a/libCacheSim/bin/cachesim/cache_init.h +++ b/libCacheSim/bin/cachesim/cache_init.h @@ -34,72 +34,72 @@ static inline cache_t *create_cache(const char *trace_path, } eviction_algo_entry_t; static const eviction_algo_entry_t simple_algos[] = { - {"lru", LRU_init}, - {"fifo", FIFO_init}, - {"arc", ARC_init}, - {"arcv0", ARCv0_init}, - {"lhd", LHD_init}, - {"random", Random_init}, - {"randomTwo", RandomTwo_init}, - {"lfu", LFU_init}, - {"gdsf", GDSF_init}, - {"lfuda", LFUDA_init}, - {"twoq", TwoQ_init}, - {"2q", TwoQ_init}, - {"slru", SLRU_init}, - {"slruv0", SLRUv0_init}, - {"lecar", LeCaR_init}, - {"lecarv0", LeCaRv0_init}, - {"RandomLRU", RandomLRU_init}, - {"cacheus", Cacheus_init}, - {"size", Size_init}, - {"lfucpp", LFUCpp_init}, - {"wtinyLFU", WTinyLFU_init}, - {"nop", nop_init}, - {"fifo-reinsertion", Clock_init}, - {"clock", Clock_init}, - {"second-chance", Clock_init}, - {"clockpro", ClockPro_init}, - {"lirs", LIRS_init}, - {"fifomerge", FIFO_Merge_init}, - {"fifo-merge", FIFO_Merge_init}, - {"flashProb", flashProb_init}, - {"sfifo", SFIFO_init}, - {"sfifov0", SFIFOv0_init}, - {"lru-prob", LRU_Prob_init}, - {"fifo-belady", FIFO_Belady_init}, - {"lru-belady", LRU_Belady_init}, - {"sieve-belady", Sieve_Belady_init}, - {"s3lru", S3LRU_init}, - {"s3fifo", S3FIFO_init}, - {"s3-fifo", S3FIFO_init}, - {"s3fifov0", S3FIFOv0_init}, - {"s3-fifov0", S3FIFOv0_init}, - {"s3fifod", S3FIFOd_init}, - {"qdlp", QDLP_init}, - {"CAR", CAR_init}, + {"lru", LRU_init}, + {"fifo", FIFO_init}, + {"arc", ARC_init}, + {"arcv0", ARCv0_init}, + {"lhd", LHD_init}, + {"random", Random_init}, + {"randomTwo", RandomTwo_init}, + {"lfu", LFU_init}, + {"gdsf", GDSF_init}, + {"lfuda", LFUDA_init}, + {"twoq", TwoQ_init}, + {"2q", TwoQ_init}, + {"slru", SLRU_init}, + {"slruv0", SLRUv0_init}, + {"lecar", LeCaR_init}, + {"lecarv0", LeCaRv0_init}, + {"RandomLRU", RandomLRU_init}, + {"cacheus", Cacheus_init}, + {"size", Size_init}, + {"lfucpp", LFUCpp_init}, + {"wtinyLFU", WTinyLFU_init}, + {"nop", nop_init}, + {"fifo-reinsertion", Clock_init}, + {"clock", Clock_init}, + {"second-chance", Clock_init}, + {"clockpro", ClockPro_init}, + {"lirs", LIRS_init}, + {"fifomerge", FIFO_Merge_init}, + {"fifo-merge", FIFO_Merge_init}, + {"flashProb", flashProb_init}, + {"sfifo", SFIFO_init}, + {"sfifov0", SFIFOv0_init}, + {"lru-prob", LRU_Prob_init}, + {"fifo-belady", FIFO_Belady_init}, + {"lru-belady", LRU_Belady_init}, + {"sieve-belady", Sieve_Belady_init}, + {"s3lru", S3LRU_init}, + {"s3fifo", S3FIFO_init}, + {"s3-fifo", S3FIFO_init}, + {"s3fifov0", S3FIFOv0_init}, + {"s3-fifov0", S3FIFOv0_init}, + {"s3fifod", S3FIFOd_init}, + {"qdlp", QDLP_init}, + {"CAR", CAR_init}, #ifdef ENABLE_3L_CACHE - {"3LCache", ThreeLCache_init}, + {"3LCache", ThreeLCache_init}, #endif #ifdef ENABLE_GLCACHE - {"GLCache", GLCache_init}, - {"gl-cache", GLCache_init}, + {"GLCache", GLCache_init}, + {"gl-cache", GLCache_init}, #endif #ifdef ENABLE_LRB - {"lrb", LRB_init}, + {"lrb", LRB_init}, #endif #ifdef INCLUDE_PRIV - {"mclock", MClock_init}, - {"lp-sfifo", LP_SFIFO_init}, - {"lp-arc", LP_ARC_init}, - {"lp-twoq", LP_TwoQ_init}, - {"qdlpv0", QDLPv0_init}, - {"s3fifodv2", S3FIFOdv2_init}, - {"myMQv1", myMQv1_init} + {"mclock", MClock_init}, + {"lp-sfifo", LP_SFIFO_init}, + {"lp-arc", LP_ARC_init}, + {"lp-twoq", LP_TwoQ_init}, + {"qdlpv0", QDLPv0_init}, + {"s3fifodv2", S3FIFOdv2_init}, + {"myMQv1", myMQv1_init} #endif -}; + }; - cache_t * (*init_func)(common_cache_params_t, const char *) = NULL; + cache_t *(*init_func)(common_cache_params_t, const char *) = NULL; for (size_t i = 0; i < sizeof(simple_algos) / sizeof(simple_algos[0]); ++i) { if (strcasecmp(eviction_algo, simple_algos[i].name) == 0) { init_func = simple_algos[i].init_func;