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

Function Clock_insert

libCacheSim/cache/eviction/Clock.c:163–175  ·  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 * and eviction is not part of this function * * @param cache * @param req * @return the inserted object */

Source from the content-addressed store, hash-verified

161 * @return the inserted object
162 */
163static cache_obj_t *Clock_insert(cache_t *cache, const request_t *req) {
164 Clock_params_t *params = (Clock_params_t *)cache->eviction_params;
165
166 cache_obj_t *obj = cache_insert_base(cache, req);
167 prepend_obj_to_head(&params->q_head, &params->q_tail, obj);
168
169 obj->clock.freq = params->init_freq;
170#ifdef USE_BELADY
171 obj->next_access_vtime = req->next_access_vtime;
172#endif
173
174 return obj;
175}
176
177/**
178 * @brief find the object to be evicted

Callers

nothing calls this directly

Calls 2

cache_insert_baseFunction · 0.85
prepend_obj_to_headFunction · 0.85

Tested by

no test coverage detected