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:
@@ -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 it’s 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",
|
||||
"}"
|
||||
]
|
||||
|
||||
Reference in New Issue
Block a user