Skip to content

Commit 45ed0ee

Browse files
committed
test: add Clock2QPlus to test_evictionAlgo
1 parent 7f3c831 commit 45ed0ee

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
@@ -289,6 +289,8 @@ static cache_t *create_test_cache(const char *alg_name,
289289
cache = S3FIFOv0_init(cc_params, "move-to-main-threshold=2");
290290
} else if (strcasecmp(alg_name, "S3-FIFO") == 0) {
291291
cache = S3FIFO_init(cc_params, "move-to-main-threshold=2");
292+
} else if (strcasecmp(alg_name, "Clock2QPlus") == 0) {
293+
cache = Clock2QPlus_init(cc_params, NULL);
292294
} else if (strcasecmp(alg_name, "Sieve") == 0) {
293295
cache = Sieve_init(cc_params, NULL);
294296
} 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
@@ -203,6 +203,13 @@ static const cache_test_data_t test_data_truth[] = {
203203
.miss_cnt_true = {90043, 83978, 81482, 77727, 72611, 72059, 67836, 65739},
204204
.miss_byte_true = {4068758016, 3792818176, 3639756288, 3379609600,
205205
3165339648, 3058814976, 2862775296, 2774183936}},
206+
{.cache_name = "Clock2QPlus",
207+
.hashpower = 20,
208+
.req_cnt_true = 113872,
209+
.req_byte_true = 4368040448,
210+
.miss_cnt_true = {90600, 81357, 75287, 72430, 70057, 65671, 60864, 55864},
211+
.miss_byte_true = {4061047808, 3577076736, 3242227712, 3061383680,
212+
2898187264, 2624986112, 2422187008, 2322797568}},
206213
#if defined(ENABLE_3L_CACHE) && ENABLE_3L_CACHE == 1
207214
{.cache_name = "3LCache",
208215
.hashpower = 20,
@@ -385,9 +392,13 @@ static void test_SR_LRU(gconstpointer user_data) {
385392
test_cache_algorithm(user_data, &test_data_truth[25]);
386393
}
387394

395+
static void test_Clock2QPlus(gconstpointer user_data) {
396+
test_cache_algorithm(user_data, &test_data_truth[26]);
397+
}
398+
388399
#if defined(ENABLE_3L_CACHE) && ENABLE_3L_CACHE == 1
389400
static void test_3LCache(gconstpointer user_data) {
390-
test_cache_algorithm(user_data, &test_data_truth[26]);
401+
test_cache_algorithm(user_data, &test_data_truth[27]);
391402
}
392403
#endif /* ENABLE_3L_CACHE */
393404

@@ -441,6 +452,8 @@ int main(int argc, char *argv[]) {
441452
g_test_add_data_func("/libCacheSim/cacheAlgo_Sieve", reader, test_Sieve);
442453
g_test_add_data_func("/libCacheSim/cacheAlgo_SLRU", reader, test_SLRU);
443454
g_test_add_data_func("/libCacheSim/cacheAlgo_SR_LRU", reader, test_SR_LRU);
455+
g_test_add_data_func("/libCacheSim/cacheAlgo_Clock2QPlus", reader,
456+
test_Clock2QPlus);
444457

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

0 commit comments

Comments
 (0)