Skip to content

Commit 7e2e9cd

Browse files
committed
Code format
1 parent 3df359e commit 7e2e9cd

1 file changed

Lines changed: 14 additions & 12 deletions

File tree

libCacheSim/cache/eviction/S4FIFO.c

Lines changed: 14 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
//
22
// This version (S4FIFO.c) is for cache miss ratio comparison only.
3-
// Since we need different combinations of parameters to achieve the best miss ratio.
4-
// And the number of combinations is large, therefore, it is performance-sensitive.
5-
// It will not gather other statistics information like hit position or others.
3+
// Since we need different combinations of parameters to achieve the best miss
4+
// ratio. And the number of combinations is large, therefore, it is
5+
// performance-sensitive. It will not gather other statistics information like
6+
// hit position or others.
67
//
78
// S4FIFO.c
89
// libCacheSim
@@ -21,7 +22,7 @@ typedef struct {
2122
cache_t *ghost_fifo;
2223
cache_t *main_fifo;
2324
bool hit_on_ghost;
24-
int hit_on_ghost_freq; // frequency of the object in ghost fifo
25+
int hit_on_ghost_freq; // frequency of the object in ghost fifo
2526

2627
int move_to_main_threshold;
2728
double small_size_ratio;
@@ -32,11 +33,12 @@ typedef struct {
3233
bool has_evicted;
3334
request_t *req_local;
3435

35-
int64_t timer; // is used for small skip logic
36+
int64_t timer; // is used for small skip logic
3637
} S4FIFO_params_t;
3738

3839
static const char *DEFAULT_CACHE_PARAMS =
39-
"small-size-ratio=0.10,ghost-size-ratio=0.90,move-to-main-threshold=2,small-skip-ratio=0,ghost-to-main-threshold=0";
40+
"small-size-ratio=0.10,ghost-size-ratio=0.90,move-to-main-threshold=2,"
41+
"small-skip-ratio=0,ghost-to-main-threshold=0";
4042

4143
// ***********************************************************************
4244
// **** ****
@@ -220,10 +222,10 @@ static cache_obj_t *S4FIFO_find(cache_t *cache, const request_t *req,
220222
}
221223

222224
// New logic:
223-
// if the obj find in the ghost fifo, check the freq > thres then added to main
224-
// otherwise just add freq
225-
if (params->ghost_fifo != NULL && params->ghost_fifo->find(
226-
params->ghost_fifo, req, false) != NULL) {
225+
// if the obj find in the ghost fifo, check the freq > thres then added to
226+
// main otherwise just add freq
227+
if (params->ghost_fifo != NULL &&
228+
params->ghost_fifo->find(params->ghost_fifo, req, false) != NULL) {
227229
cache_obj_t *ghost_obj =
228230
params->ghost_fifo->find(params->ghost_fifo, req, false);
229231
int64_t ghost_freq = ghost_obj->S4FIFO.freq;
@@ -264,7 +266,7 @@ static cache_obj_t *S4FIFO_insert(cache_t *cache, const request_t *req) {
264266
cache_t *small = params->small_fifo;
265267
cache_t *main = params->main_fifo;
266268

267-
if (params->hit_on_ghost) {
269+
if (params->hit_on_ghost) {
268270
/* insert into main FIFO */
269271
params->hit_on_ghost = false;
270272
params->hit_on_ghost_freq = 0;
@@ -280,7 +282,7 @@ static cache_obj_t *S4FIFO_insert(cache_t *cache, const request_t *req) {
280282
obj = main->insert(main, req);
281283
} else {
282284
obj = small->insert(small, req);
283-
params->timer++; // only increase timer when insert into small fifo
285+
params->timer++; // only increase timer when insert into small fifo
284286
obj->time_stamp = params->timer;
285287
}
286288
}

0 commit comments

Comments
 (0)