fix(simulation): Evaluation of age was based on hits instead of access_count

Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
This commit is contained in:
Tuan-Dat Tran
2024-11-28 15:57:19 +01:00
parent a484d49128
commit f9d48e6fe4
42 changed files with 1320 additions and 36118 deletions

View File

@@ -173,6 +173,7 @@
" else:\n",
" # Cache miss: increment miss count\n",
" self.misses[obj_id] += 1\n",
" self.cumulative_age[obj_id] += 0\n",
" self.access_count[obj_id] += 1\n",
" \n",
" # Fetch the object from the database if its not in cache\n",
@@ -497,7 +498,7 @@
"outputs": [],
"source": [
"avg_age = {\n",
" obj_id: cache.cumulative_age[obj_id] / max(1, cache.hits[obj_id]) \n",
" obj_id: cache.cumulative_age[obj_id] / max(1, cache.access_count[obj_id]) \n",
" for obj_id in range(1, DATABASE_OBJECTS + 1)\n",
"}"
]