Skip to content

Commit

Permalink
update
Browse files Browse the repository at this point in the history
  • Loading branch information
bobob committed Aug 20, 2024
1 parent b84516a commit d042ea6
Show file tree
Hide file tree
Showing 5 changed files with 20 additions and 2 deletions.
2 changes: 2 additions & 0 deletions libCacheSim/bin/cachesim/cache_init.h
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,8 @@ static inline cache_t *create_cache(const char *trace_path,
cache = LRU_delay_init(cc_params, eviction_params);
} else if (strcasecmp(eviction_algo, "lru-probv0") == 0) {
cache = lpLRU_prob_init(cc_params, eviction_params);
} else if (strcasecmp(eviction_algo, "predprob") == 0) {
cache = PredProb_init(cc_params, eviction_params);
} else if (strcasecmp(eviction_algo, "fh") == 0){
cache = FH_init(cc_params, eviction_params);
} else if (strcasecmp(eviction_algo, "fifo-belady") == 0) {
Expand Down
1 change: 1 addition & 0 deletions libCacheSim/cache/eviction/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ set(sourceC
WTinyLFU.c
Size.c
LRUProb.c
pred_prob.c
LRUdelay.c
LRUdelayv1.c
QDLP.c
Expand Down
15 changes: 13 additions & 2 deletions libCacheSim/cache/eviction/Clock.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,8 +232,18 @@ static void Clock_evict(cache_t *cache, const request_t *req) {
double expected_reuse_distance = (double)cache -> cache_size / miss_ratio;

cache_obj_t *obj_to_evict = params->q_tail;
int64_t reuse_distance = obj_to_evict->clock.next_access_vtime - params->vtime;
while (reuse_distance != INT64_MAX && reuse_distance <= expected_reuse_distance && obj_to_evict->clock.check_time != params->vtime) {
int64_t reuse_distance = 0L;
int64_t n_round = 0;
if (obj_to_evict -> clock.next_access_vtime != INT64_MAX) {
reuse_distance = obj_to_evict->clock.next_access_vtime - params->vtime;
}else{
reuse_distance = INT64_MAX;
}
while (reuse_distance != INT64_MAX && reuse_distance <= expected_reuse_distance) {
if (obj_to_evict -> clock.check_time == params->vtime) {
// printf("check time reached\n");
break;
}
obj_to_evict->clock.freq -= 1;
params->n_obj_rewritten += 1;
params->n_byte_rewritten += obj_to_evict->obj_size;
Expand All @@ -242,6 +252,7 @@ static void Clock_evict(cache_t *cache, const request_t *req) {
obj_to_evict->clock.check_time = params->vtime;
obj_to_evict = params->q_tail;
reuse_distance = obj_to_evict->clock.next_access_vtime - params->vtime;
printf("promotion: %d\n", cache->n_promotion);
}

remove_obj_from_list(&params->q_head, &params->q_tail, obj_to_evict);
Expand Down
1 change: 1 addition & 0 deletions libCacheSim/include/libCacheSim/cacheObj.h
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,7 @@ typedef struct {

typedef struct {
int64_t freq;
float scaler;
} LRUProb_obj_metadata_t;

typedef struct {
Expand Down
3 changes: 3 additions & 0 deletions libCacheSim/include/libCacheSim/evictionAlgo.h
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,9 @@ cache_t *flashProb_init(const common_cache_params_t ccache_params,
cache_t *LRU_Prob_init(const common_cache_params_t ccache_params,
const char *cache_specific_params);

cache_t *PredProb_init(const common_cache_params_t ccache_params,
const char *cache_specific_params);

cache_t *SFIFOv0_init(const common_cache_params_t ccache_params,
const char *cache_specific_params);

Expand Down

0 comments on commit d042ea6

Please sign in to comment.