Skip to content

Commit bfffa02

Browse files
committed
fix a bug in sieve
1 parent a7adefb commit bfffa02

2 files changed

Lines changed: 6 additions & 21 deletions

File tree

libCacheSim/cache/eviction/priv/Sieve.c

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -225,26 +225,11 @@ static void Sieve_evict(cache_t *cache, const request_t *req) {
225225
/* if we have run one full around or first eviction */
226226
cache_obj_t *obj = params->pointer == NULL ? params->q_tail : params->pointer;
227227

228-
while (obj->myclock.freq > 0) {
229-
obj->myclock.freq -= 1;
228+
while (obj->sieve.freq > 0) {
229+
obj->sieve.freq -= 1;
230230
obj = obj->queue.prev == NULL ? params->q_tail : obj->queue.prev;
231231
}
232232

233-
/* find the first untouched */
234-
// while ((obj != NULL && obj->sieve.freq > 0)) {
235-
// obj->sieve.freq -= 1;
236-
// obj = obj->queue.prev;
237-
// }
238-
239-
// /* if we have finished one around, start from the tail */
240-
// if (obj == NULL) {
241-
// obj = params->q_tail;
242-
// while (obj != NULL && obj->sieve.freq > 0) {
243-
// obj->sieve.freq -= 1;
244-
// obj = obj->queue.prev;
245-
// }
246-
// }
247-
248233
params->pointer = obj->queue.prev;
249234
remove_obj_from_list(&params->q_head, &params->q_tail, obj);
250235
cache_evict_base(cache, obj, true);

test/test_evictionAlgo.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -496,10 +496,10 @@ static void test_S3FIFO(gconstpointer user_data) {
496496
}
497497

498498
static void test_Sieve(gconstpointer user_data) {
499-
uint64_t miss_cnt_true[] = {93403, 89386, 84387, 84025,
500-
72498, 72228, 72182, 72140};
501-
uint64_t miss_byte_true[] = {4213112832, 4052646400, 3829170176, 3807412736,
502-
3093146112, 3079525888, 3079210496, 3077547520};
499+
uint64_t miss_cnt_true[] = {91699, 86720, 78578, 76707,
500+
69945, 66221, 64445, 64376};
501+
uint64_t miss_byte_true[] = {4158632960, 3917211648, 3536227840, 3455379968,
502+
3035580416, 2801699328, 2699456000, 2696345600};
503503

504504
reader_t *reader = (reader_t *)user_data;
505505
common_cache_params_t cc_params = {

0 commit comments

Comments
 (0)