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

Function cache_evict_base

libCacheSim/cache/cache.c:293–311  ·  view source on GitHub ↗

* @brief this function is called by all eviction algorithms in the eviction * function, it updates the cache metadata. Because it frees the object struct, * it needs to be called at the end of the eviction function. * * @param cache the cache * @param obj the object to be removed */

Source from the content-addressed store, hash-verified

291 * @param obj the object to be removed
292 */
293void cache_evict_base(cache_t *cache, cache_obj_t *obj, bool remove_from_hashtable) {
294#if defined(TRACK_EVICTION_V_AGE)
295 if (cache->track_eviction_age) {
296 record_eviction_age(cache, obj, CURR_TIME(cache, req) - obj->create_time);
297 }
298#endif
299 if (cache->prefetcher && cache->prefetcher->handle_evict) {
300 request_t *check_req = new_request();
301 check_req->obj_id = obj->obj_id;
302 check_req->obj_size = obj->obj_size;
303 // check_req->ttl = 0; // re-add objects should be?
304 cache_remove_obj_base(cache, obj, remove_from_hashtable);
305 cache->prefetcher->handle_evict(cache, check_req);
306 my_free(sizeof(request_t), check_req);
307 return;
308 }
309
310 cache_remove_obj_base(cache, obj, remove_from_hashtable);
311}
312
313/**
314 * @brief this function is called by all eviction algorithms that

Callers 15

Clock_evictFunction · 0.85
FIFO_evictFunction · 0.85
RandomLRU_evictFunction · 0.85
LFUDA_evictFunction · 0.85
LFU_evictFunction · 0.85
LRU_evictFunction · 0.85
Size_evictFunction · 0.85
_ARC_evict_L1_dataFunction · 0.85
_ARC_evict_L2_dataFunction · 0.85
MRU_evictFunction · 0.85
LeCaR_evictFunction · 0.85

Calls 3

record_eviction_ageFunction · 0.85
new_requestFunction · 0.85
cache_remove_obj_baseFunction · 0.85

Tested by

no test coverage detected