fix(simulation): Updated avg_age calculation not only for details.csv, but all avg_age calculation.
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
@@ -473,7 +473,7 @@
|
||||
"for obj_id in range(1, DATABASE_OBJECTS + 1):\n",
|
||||
" if cache.access_count[obj_id] != 0:\n",
|
||||
" hit_rate = cache.hits[obj_id] / max(1, cache.access_count[obj_id]) # Avoid division by zero\n",
|
||||
" avg_age = cache.cumulative_age[obj_id] / max(1, cache.hits[obj_id]) # Only average over hits\n",
|
||||
" avg_age = cache.cumulative_age[obj_id] / max(1, cache.access_count[obj_id]) # Only average over hits\n",
|
||||
" print(f\"Object {obj_id}: Hit Rate = {hit_rate:.2f}, Average Age = {avg_age:.2f}\")\n",
|
||||
" statistics.append({\"obj_id\": obj_id,\"hit_rate\": hit_rate,\"avg_age\": avg_age})"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user