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:
Tuan-Dat Tran
2024-11-28 16:38:55 +01:00
parent 3a9e3105f2
commit ad4654dd0f
34 changed files with 1263 additions and 1263 deletions

View File

@@ -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})"
]