Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion libCacheSim/cache/eviction/ClockPro.c
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ static void ClockPro_parse_params(cache_t *cache,
params->init_ref = strtol(value, &end, 10);
} else if (strcasecmp(key, "init-ratio-cold") == 0) {
const double ratio = strtod(value, &end);
params->mem_cold_max = (int64_t)((double)cache->cache_size * ratio);
params->mem_cold_max = (int64_t)(cache->cache_size * ratio);
} else if (strcasecmp(key, "print") == 0) {
printf("current parameters: %s\n",
ClockPro_current_params(cache, params));
Expand Down
8 changes: 7 additions & 1 deletion libCacheSim/cache/eviction/QDLP.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,17 @@ cache_t *QDLP_init(const common_cache_params_t ccache_params,
}

int64_t fifo_cache_size =
(int64_t)ccache_params.cache_size * params->small_size_ratio;
(int64_t)(ccache_params.cache_size * params->small_size_ratio);
int64_t main_cache_size = ccache_params.cache_size - fifo_cache_size;
int64_t ghost_cache_size =
(int64_t)(ccache_params.cache_size * params->ghost_size_ratio);

if (fifo_cache_size <= 0 || main_cache_size <= 0) {
ERROR(
"Invalid cache size configuration: fifo=%lld bytes, main=%lld bytes\n",
(long long)fifo_cache_size, (long long)main_cache_size);
}

common_cache_params_t ccache_params_local = ccache_params;
ccache_params_local.cache_size = fifo_cache_size;
params->small_cache = FIFO_init(ccache_params_local, NULL);
Expand Down
10 changes: 9 additions & 1 deletion libCacheSim/cache/eviction/S3FIFO.c
Original file line number Diff line number Diff line change
Expand Up @@ -112,11 +112,19 @@ cache_t *S3FIFO_init(const common_cache_params_t ccache_params,
}

int64_t small_fifo_size =
(int64_t)ccache_params.cache_size * params->small_size_ratio;
(int64_t)(ccache_params.cache_size * params->small_size_ratio);
int64_t main_fifo_size = ccache_params.cache_size - small_fifo_size;
int64_t ghost_fifo_size =
(int64_t)(ccache_params.cache_size * params->ghost_size_ratio);

if (small_fifo_size <= 0 || main_fifo_size <= 0) {
ERROR(
"Invalid cache size configuration: small_fifo=%lld bytes, "
"main_fifo=%lld "
"bytes\n",
(long long)small_fifo_size, (long long)main_fifo_size);
}

common_cache_params_t ccache_params_local = ccache_params;
ccache_params_local.cache_size = small_fifo_size;
params->small_fifo = FIFO_init(ccache_params_local, NULL);
Expand Down
9 changes: 8 additions & 1 deletion libCacheSim/cache/eviction/S3FIFOd.c
Original file line number Diff line number Diff line change
Expand Up @@ -101,10 +101,17 @@ cache_t *S3FIFOd_init(const common_cache_params_t ccache_params,
}

int64_t fifo_cache_size =
(int64_t)ccache_params.cache_size * params->small_fifo_size_ratio;
(int64_t)(ccache_params.cache_size * params->small_fifo_size_ratio);
int64_t main_fifo_size = ccache_params.cache_size - fifo_cache_size;
int64_t ghost_fifo = main_fifo_size;

if (fifo_cache_size <= 0 || main_fifo_size <= 0) {
ERROR(
"Invalid cache size configuration: fifo=%lld bytes, main_fifo=%lld "
"bytes\n",
(long long)fifo_cache_size, (long long)main_fifo_size);
}

common_cache_params_t ccache_params_local = ccache_params;
ccache_params_local.cache_size = fifo_cache_size;
params->small_fifo = FIFO_init(ccache_params_local, NULL);
Expand Down
9 changes: 8 additions & 1 deletion libCacheSim/cache/eviction/S3FIFOv0.c
Original file line number Diff line number Diff line change
Expand Up @@ -110,11 +110,18 @@ cache_t *S3FIFOv0_init(const common_cache_params_t ccache_params,
}

int64_t fifo_cache_size =
(int64_t)ccache_params.cache_size * params->small_size_ratio;
(int64_t)(ccache_params.cache_size * params->small_size_ratio);
int64_t main_fifo_size = ccache_params.cache_size - fifo_cache_size;
int64_t ghostfifo__cachee_siz =
(int64_t)(ccache_params.cache_size * params->ghost_size_ratio);

if (fifo_cache_size <= 0 || main_fifo_size <= 0) {
ERROR(
"Invalid cache size configuration: fifo=%lld bytes, main_fifo=%lld "
"bytes\n",
(long long)fifo_cache_size, (long long)main_fifo_size);
}

common_cache_params_t ccache_params_local = ccache_params;
ccache_params_local.cache_size = fifo_cache_size;
params->small_fifo = FIFO_init(ccache_params_local, NULL);
Expand Down
6 changes: 5 additions & 1 deletion libCacheSim/cache/eviction/SLRU.c
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ cache_t *SLRU_init(const common_cache_params_t ccache_params,
params->lru_max_n_bytes = calloc(params->n_seg, sizeof(int64_t));
for (int i = 0; i < params->n_seg; i++) {
params->lru_max_n_bytes[i] =
(int64_t)ccache_params.cache_size / params->n_seg;
(int64_t)(ccache_params.cache_size / params->n_seg);
}
}

Expand Down Expand Up @@ -455,6 +455,10 @@ static void SLRU_parse_params(cache_t *cache,
params->lru_max_n_bytes[i] =
(int64_t)((double)seg_size_array[i] / seg_size_sum *
cache->cache_size);
if (params->lru_max_n_bytes[i] <= 0) {
ERROR("Invalid segment size for segment %d: %lld bytes\n", i,
(long long)params->lru_max_n_bytes[i]);
}
}
} else if (strcasecmp(key, "print") == 0) {
printf("current parameters: %s\n", SLRU_current_params(cache, params));
Expand Down
7 changes: 6 additions & 1 deletion libCacheSim/cache/eviction/other/S3LRU.c
Original file line number Diff line number Diff line change
Expand Up @@ -106,11 +106,16 @@ cache_t *S3LRU_init(const common_cache_params_t ccache_params,
}

int64_t LRU_cache_size =
(int64_t)ccache_params.cache_size * params->LRU_size_ratio;
(int64_t)(ccache_params.cache_size * params->LRU_size_ratio);
int64_t main_cache_size = ccache_params.cache_size - LRU_cache_size;
int64_t LRU_ghost_cache_size =
(int64_t)(ccache_params.cache_size * params->ghost_size_ratio);

if (LRU_cache_size <= 0 || main_cache_size <= 0) {
ERROR("Invalid cache size configuration: LRU=%lld bytes, main=%lld bytes\n",
(long long)LRU_cache_size, (long long)main_cache_size);
}

common_cache_params_t ccache_params_local = ccache_params;
ccache_params_local.cache_size = LRU_cache_size;
// params->LRU = LRU_init(ccache_params_local, NULL);
Expand Down
7 changes: 6 additions & 1 deletion libCacheSim/cache/eviction/other/flashProb.c
Original file line number Diff line number Diff line change
Expand Up @@ -91,9 +91,14 @@ cache_t *flashProb_init(const common_cache_params_t ccache_params,
}

int64_t ram_cache_size =
(int64_t)ccache_params.cache_size * params->ram_size_ratio;
(int64_t)(ccache_params.cache_size * params->ram_size_ratio);
int64_t disk_cache_size = ccache_params.cache_size - ram_cache_size;

if (ram_cache_size <= 0 || disk_cache_size <= 0) {
ERROR("Invalid cache size configuration: ram=%lld bytes, disk=%lld bytes\n",
(long long)ram_cache_size, (long long)disk_cache_size);
}

common_cache_params_t ccache_params_local = ccache_params;
ccache_params_local.cache_size = ram_cache_size;
if (strcasecmp(params->ram_cache_type, "ARC") == 0) {
Expand Down
Loading