MCPcopy Create free account
hub / github.com/1a1a11a/libCacheSim / SLRU_get_debug

Function SLRU_get_debug

libCacheSim/cache/eviction/SLRU.c:554–584  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

552}
553
554bool SLRU_get_debug(cache_t *cache, const request_t *req) {
555 // SLRU_params_t *params = (SLRU_params_t *)(cache->eviction_params);
556 cache->n_req += 1;
557
558 DEBUG_PRINT_CACHE_STATE(cache, params, req);
559
560 bool cache_hit = cache->find(cache, req, true) != NULL;
561
562 if (cache_hit) {
563 DEBUG_PRINT_CACHE(cache, params);
564 return cache_hit;
565 }
566
567 if (cache->can_insert(cache, req) == false) {
568 DEBUG_PRINT_CACHE(cache, params);
569 return cache_hit;
570 }
571
572 if (!cache_hit) {
573 while (cache->occupied_byte + req->obj_size + cache->obj_md_size >
574 cache->cache_size) {
575 cache->evict(cache, req);
576 }
577
578 cache->insert(cache, req);
579 }
580
581 DEBUG_PRINT_CACHE(cache, params);
582
583 return cache_hit;
584}
585
586#ifdef __cplusplus
587extern "C"

Callers 1

SLRU_getFunction · 0.85

Calls 3

findMethod · 0.45
evictMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected