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

Function Size_evict

libCacheSim/cache/eviction/Size.c:199–212  ·  view source on GitHub ↗

* @brief evict an object from the cache * it needs to call cache_evict_base before returning * which updates some metadata such as n_obj, occupied size, and hash table * * @param cache * @param req not used */

Source from the content-addressed store, hash-verified

197 * @param req not used
198 */
199static void Size_evict(cache_t *cache,
200 const request_t *req) {
201 Size_params_t *params = cache->eviction_params;
202 pq_node_t *node = (pq_node_t *)pqueue_pop(params->pq);
203
204 cache_obj_t *obj_to_evict =
205 hashtable_find_obj_id(cache->hashtable, node->obj_id);
206 DEBUG_ASSERT(node == obj_to_evict->Size.pq_node);
207
208 obj_to_evict->Size.pq_node = NULL;
209 my_free(sizeof(pq_node_t), node);
210
211 cache_evict_base(cache, obj_to_evict, true);
212}
213
214static void Size_remove_obj(cache_t *cache, cache_obj_t *obj) {
215 Size_params_t *params = cache->eviction_params;

Callers

nothing calls this directly

Calls 2

pqueue_popFunction · 0.85
cache_evict_baseFunction · 0.85

Tested by

no test coverage detected