Skip to content

Commit 6aae113

Browse files
committed
update eviction camke
remove private
1 parent 125f582 commit 6aae113

8 files changed

Lines changed: 132 additions & 2367 deletions

File tree

CMakeLists.txt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,6 @@ if(USE_HUGEPAGE)
6565
add_compile_definitions(USE_HUGEPAGE=1)
6666
endif()
6767

68-
if(EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/libCacheSim/cache/eviction/priv")
69-
add_compile_definitions(INCLUDE_PRIV=1)
70-
endif()
71-
7268
string(TOLOWER "${LOG_LEVEL}" LOG_LEVEL_LOWER)
7369

7470
if(LOG_LEVEL_LOWER STREQUAL "vvverbose")

libCacheSim/bin/cachesim/cache_init.h

Lines changed: 29 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -12,18 +12,22 @@
1212
extern "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);

libCacheSim/cache/eviction/CMakeLists.txt

Lines changed: 2 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -46,20 +46,6 @@ set(sourceC
4646
RandomLRU.c
4747
)
4848

49-
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/priv")
50-
set(sourceC ${sourceC}
51-
52-
priv/QDLPv0.c
53-
54-
55-
priv/S3FIFOdv2.c
56-
57-
priv/myMQv1.c
58-
59-
priv/MClock.c
60-
)
61-
endif()
62-
6349
if (EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/fifo")
6450
set(sourceC ${sourceC}
6551
fifo/LP_SFIFO.c
@@ -126,13 +112,6 @@ set_target_properties(evictionCPP
126112
CXX_EXTENSIONS NO
127113
)
128114

129-
# set (evictionLib
130-
# evictionC
131-
# evictionCPP
132-
# )
133-
134-
135-
136-
# add_library(eviction INTERFACE)
137-
# target_link_libraries(eviction INTERFACE ${evictionLib})
115+
add_library(eviction INTERFACE)
116+
target_link_libraries(eviction INTERFACE evictionC evictionCPP)
138117

0 commit comments

Comments
 (0)