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

Function S3FIFOd_insert

libCacheSim/cache/eviction/S3FIFOd.c:351–372  ·  view source on GitHub ↗

* @brief insert an object into the cache, * update the hash table and cache metadata * this function assumes the cache has enough space * eviction should be * performed before calling this function * * @param cache * @param req * @return the inserted object */

Source from the content-addressed store, hash-verified

349 * @return the inserted object
350 */
351static cache_obj_t *S3FIFOd_insert(cache_t *cache, const request_t *req) {
352 S3FIFOd_params_t *params = (S3FIFOd_params_t *)cache->eviction_params;
353 cache_obj_t *obj = NULL;
354
355 if (params->hit_on_ghost) {
356 /* insert into the ARC */
357 params->hit_on_ghost = false;
358 params->main_cache->get(params->main_cache, req);
359 obj = params->main_cache->find(params->main_cache, req, false);
360 } else {
361 /* insert into the fifo */
362 obj = params->fifo->insert(params->fifo, req);
363 }
364
365 assert(obj->misc.freq == 0);
366
367#if defined(TRACK_EVICTION_V_AGE)
368 obj->create_time = CURR_TIME(cache, req);
369#endif
370
371 return obj;
372}
373
374/**
375 * @brief find the object to be evicted

Callers

nothing calls this directly

Calls 4

assertFunction · 0.85
getMethod · 0.45
findMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected