You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: doc/quickstart_plugin.md
+18-1Lines changed: 18 additions & 1 deletion
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ graph LR
17
17
D -->|No| F{libCacheSim Cache Full?}
18
18
F -->|Yes| G["cache_eviction_hook()<br/>plugin cache determines the object(s) to evict"]
19
19
F -->|No| H["cache_miss_hook()<br/>Update plugin cache stats"]
20
-
G --> H
20
+
G --> F
21
21
22
22
style E fill:#bfb,stroke:#333,stroke-width:2px
23
23
style G fill:#fbb,stroke:#333,stroke-width:2px
@@ -300,6 +300,23 @@ For Python examples, see the `libCacheSim-python/README.md` file which contains
300
300
***Performance Issues**: Use `process_trace()` for large workloads instead of individual `get()` calls for better performance.
301
301
***Memory Usage**: Monitor cache statistics (`cache.occupied_byte`) and ensure proper cache size limits for your system.
302
302
***Custom Cache Issues**: Validate your custom implementation against built-in algorithms using test functions.
303
+
***Implementation Issues**: When re-implementing an eviction algorithm in libCacheSim using the plugin system, note that the core hook functions are simplified. This may introduce some challenges. The central function for cache simulation is `get` and its common internal logic is:
304
+
305
+
```mermaid
306
+
graph LR
307
+
C["find() (Cache state is updated automatically, since update_cache = true by default)"] --> D{Found in cache?}
308
+
D -->|Yes| E["cache_hit_hook()"]
309
+
D -->|No| F{"Cache full?"}
310
+
F -->|"Yes (no space for new object)"| G["cache_eviction_hook()"]
311
+
F -->|No| H["cache_miss_hook()"]
312
+
G --> F
313
+
314
+
style E fill:#bfb,stroke:#333,stroke-width:2px
315
+
style G fill:#fbb,stroke:#333,stroke-width:2px
316
+
style H fill:#bbf,stroke:#333,stroke-width:2px
317
+
```
318
+
319
+
Because find is not exposed to plugins, any state-update logic that normally happens inside find must instead be implemented inside the relevant hook functions (cache_hit_hook, cache_eviction_hook, or cache_miss_hook) according to your algorithm’s needs.
0 commit comments