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

Function SFIFO_get_debug

libCacheSim/cache/eviction/fifo/SFIFO.c:515–550  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

513}
514
515bool SFIFO_get_debug(cache_t *cache, const request_t *req) {
516 cache->n_req += 1;
517
518 // SFIFO_params_t *params = (SFIFO_params_t *)(cache->eviction_params);
519 cache->last_request_metadata = "none";
520 DEBUG_PRINT_CACHE_STATE(cache, params, req);
521
522 bool cache_hit = cache->find(cache, req, true) != NULL;
523 if (cache_hit) {
524 cache->last_request_metadata = "hit";
525 } else {
526 cache->last_request_metadata = "miss";
527 }
528 DEBUG_PRINT_CACHE_STATE(cache, params, req);
529
530 if (cache_hit) {
531 return cache_hit;
532 }
533
534 if (cache->can_insert(cache, req) == false) {
535 return cache_hit;
536 }
537
538 if (!cache_hit) {
539 while (cache->occupied_byte + req->obj_size + cache->obj_md_size >
540 cache->cache_size) {
541 cache->evict(cache, req);
542 }
543
544 cache->insert(cache, req);
545 }
546
547 DEBUG_PRINT_CACHE_STATE(cache, params, req);
548
549 return cache_hit;
550}
551
552#ifdef __cplusplus
553extern "C"

Callers 1

SFIFO_getFunction · 0.85

Calls 3

findMethod · 0.45
evictMethod · 0.45
insertMethod · 0.45

Tested by

no test coverage detected