Skip to content

Commit d536cb8

Browse files
committed
test: add Clock2QPlus to test_evictionAlgo
1 parent 554c04b commit d536cb8

2 files changed

Lines changed: 16 additions & 1 deletion

File tree

test/common.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ static cache_t *create_test_cache(const char *alg_name,
291291
cache = S3FIFOv0_init(cc_params, "move-to-main-threshold=2");
292292
} else if (strcasecmp(alg_name, "S3-FIFO") == 0) {
293293
cache = S3FIFO_init(cc_params, "move-to-main-threshold=2");
294+
} else if (strcasecmp(alg_name, "Clock2QPlus") == 0) {
295+
cache = Clock2QPlus_init(cc_params, NULL);
294296
} else if (strcasecmp(alg_name, "Sieve") == 0) {
295297
cache = Sieve_init(cc_params, NULL);
296298
} else if (strcasecmp(alg_name, "Mithril") == 0) {

test/test_evictionAlgo.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,6 +196,13 @@ static const cache_test_data_t test_data_truth[] = {
196196
.miss_cnt_true = {90043, 83978, 81482, 77727, 72611, 72059, 67836, 65739},
197197
.miss_byte_true = {4068758016, 3792818176, 3639756288, 3379609600,
198198
3165339648, 3058814976, 2862775296, 2774183936}},
199+
{.cache_name = "Clock2QPlus",
200+
.hashpower = 20,
201+
.req_cnt_true = 113872,
202+
.req_byte_true = 4368040448,
203+
.miss_cnt_true = {90600, 81357, 75287, 72430, 70057, 65671, 60864, 55864},
204+
.miss_byte_true = {4061047808, 3577076736, 3242227712, 3061383680,
205+
2898187264, 2624986112, 2422187008, 2322797568}},
199206
#if defined(ENABLE_3L_CACHE) && ENABLE_3L_CACHE == 1
200207
{.cache_name = "3LCache",
201208
.hashpower = 20,
@@ -374,9 +381,13 @@ static void test_SR_LRU(gconstpointer user_data) {
374381
test_cache_algorithm(user_data, &test_data_truth[24]);
375382
}
376383

384+
static void test_Clock2QPlus(gconstpointer user_data) {
385+
test_cache_algorithm(user_data, &test_data_truth[25]);
386+
}
387+
377388
#if defined(ENABLE_3L_CACHE) && ENABLE_3L_CACHE == 1
378389
static void test_3LCache(gconstpointer user_data) {
379-
test_cache_algorithm(user_data, &test_data_truth[25]);
390+
test_cache_algorithm(user_data, &test_data_truth[26]);
380391
}
381392
#endif /* ENABLE_3L_CACHE */
382393

@@ -429,6 +440,8 @@ int main(int argc, char *argv[]) {
429440
g_test_add_data_func("/libCacheSim/cacheAlgo_Sieve", reader, test_Sieve);
430441
g_test_add_data_func("/libCacheSim/cacheAlgo_SLRU", reader, test_SLRU);
431442
g_test_add_data_func("/libCacheSim/cacheAlgo_SR_LRU", reader, test_SR_LRU);
443+
g_test_add_data_func("/libCacheSim/cacheAlgo_Clock2QPlus", reader,
444+
test_Clock2QPlus);
432445

433446
#if defined(ENABLE_3L_CACHE) && ENABLE_3L_CACHE == 1
434447
g_test_add_data_func("/libCacheSim/cacheAlgo_3LCache", reader, test_3LCache);

0 commit comments

Comments
 (0)