Skip to content

Commit 91f703a

Browse files
authored
[Docs] Fix the illustration of plugin workflow (1a1a11a#288)
* Fix the illustration of plugin workflow * Update TOC * Update note
1 parent 66df264 commit 91f703a

2 files changed

Lines changed: 34 additions & 13 deletions

File tree

doc/README.md

Lines changed: 16 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,19 @@
1+
# CacheSim Documentation
12

2-
## Main tools
3-
* [cachesim](quickstart_cachesim.md)
4-
* [trace utils](quickstart_traceUtils.md)
5-
* [trace analysis](quickstart_traceAnalysis.md)
3+
## Quickstart Guides
4+
- [CacheSim: Command-line cache simulator](quickstart_cachesim.md)
5+
- [Trace Utilities](quickstart_traceUtils.md)
6+
- [Trace Analyzer](quickstart_traceAnalyzer.md)
7+
- [MRC Profiler](quickstart_mrcProfiler.md)
8+
- [Plugin System](quickstart_plugin.md)
69

7-
## Using libCacheSim as a library
8-
* [library](lib.md)
9-
* [add a new algorithm](lib_extend.md)
10-
* [API](lib_api.md)
11-
12-
13-
## Benchmarks
14-
* [benchmarks](quickstart_benchmarks.md)
10+
## Advanced Usage
11+
- [Library Usage Guide](advanced_lib.md)
12+
- [How to Add a New Algorithm](advanced_lib_extend.md)
13+
- [API Reference (C)](API.md)
14+
- [Performance Tuning](performance.md)
15+
- [Memory Usage Profiling](memory_usage_profiling.md)
1516

17+
## Developer Documentation
18+
- [Debugging Guide](debug.md)
19+
- [Install & Build](install.md)

doc/quickstart_plugin.md

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ graph LR
1717
D -->|No| F{libCacheSim Cache Full?}
1818
F -->|Yes| G["cache_eviction_hook()<br/>plugin cache determines the object(s) to evict"]
1919
F -->|No| H["cache_miss_hook()<br/>Update plugin cache stats"]
20-
G --> H
20+
G --> F
2121
2222
style E fill:#bfb,stroke:#333,stroke-width:2px
2323
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
300300
* **Performance Issues**: Use `process_trace()` for large workloads instead of individual `get()` calls for better performance.
301301
* **Memory Usage**: Monitor cache statistics (`cache.occupied_byte`) and ensure proper cache size limits for your system.
302302
* **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.
303320

304321
---
305322

0 commit comments

Comments
 (0)