@@ -195,7 +195,17 @@ static const cache_test_data_t test_data_truth[] = {
195195 .req_byte_true = 4368040448 ,
196196 .miss_cnt_true = {90043 , 83978 , 81482 , 77727 , 72611 , 72059 , 67836 , 65739 },
197197 .miss_byte_true = {4068758016 , 3792818176 , 3639756288 , 3379609600 ,
198- 3165339648 , 3058814976 , 2862775296 , 2774183936 }}};
198+ 3165339648 , 3058814976 , 2862775296 , 2774183936 }},
199+ #if defined(ENABLE_3L_CACHE ) && ENABLE_3L_CACHE == 1
200+ {.cache_name = "3LCache" ,
201+ .hashpower = 20 ,
202+ .req_cnt_true = 113872 ,
203+ .req_byte_true = 4368040448 ,
204+ .miss_cnt_true = {93374 , 89783 , 83572 , 81722 , 72494 , 72104 , 71972 , 71704 },
205+ .miss_byte_true = {4214303232 , 4061242368 , 3778040320 , 3660569600 ,
206+ 3100927488 , 3078128640 , 3075403776 , 3061662720 }},
207+ #endif /* ENABLE_3L_CACHE */
208+ };
199209
200210static void _verify_profiler_results (const cache_stat_t * res ,
201211 uint64_t num_of_sizes ,
@@ -255,7 +265,7 @@ static void test_cache_algorithm(gconstpointer user_data,
255265 test_data -> miss_byte_true );
256266
257267 cache -> cache_free (cache );
258- my_free (sizeof (cache_stat_t ), res );
268+ my_free (sizeof (cache_stat_t ) * ( CACHE_SIZE / STEP_SIZE ) , res );
259269}
260270
261271// Individual test functions (ordered alphabetically)
@@ -364,6 +374,12 @@ static void test_SR_LRU(gconstpointer user_data) {
364374 test_cache_algorithm (user_data , & test_data_truth [24 ]);
365375}
366376
377+ #if defined(ENABLE_3L_CACHE ) && ENABLE_3L_CACHE == 1
378+ static void test_3LCache (gconstpointer user_data ) {
379+ test_cache_algorithm (user_data , & test_data_truth [25 ]);
380+ }
381+ #endif /* ENABLE_3L_CACHE */
382+
367383static void test_WTinyLFU (gconstpointer user_data ) {
368384 // TODO: to be implemented
369385}
@@ -414,6 +430,10 @@ int main(int argc, char *argv[]) {
414430 g_test_add_data_func ("/libCacheSim/cacheAlgo_SLRU" , reader , test_SLRU );
415431 g_test_add_data_func ("/libCacheSim/cacheAlgo_SR_LRU" , reader , test_SR_LRU );
416432
433+ #if defined(ENABLE_3L_CACHE ) && ENABLE_3L_CACHE == 1
434+ g_test_add_data_func ("/libCacheSim/cacheAlgo_3LCache" , reader , test_3LCache );
435+ #endif /* ENABLE_3L_CACHE */
436+
417437 // Belady algorithms require reader that has next access information
418438 // and can only use oracleGeneral trace (which we're using)
419439 g_test_add_data_func ("/libCacheSim/cacheAlgo_Belady" , reader , test_Belady );
0 commit comments