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
* simulate a complex cache hierarchy and topology.
8
-
For example, build a cache hierarchy with multiple layers to study the impact of exclusive and inclusive caching; or build a cache cluster with consistent hashing to explore the different load balancing techniques on caching.
7
+
* simulate a complex cache hierarchy and topology.
8
+
For example, build a cache hierarchy with multiple layers to study the impact of exclusive and inclusive caching; or build a cache cluster with consistent hashing to explore the different load balancing techniques on caching.
9
9
10
10
11
11
---
12
12
13
-
## libCacheSim Modules
14
-
Currently there are four main modules in libCacheSim,
13
+
## libCacheSim Modules
14
+
Currently there are four main modules in libCacheSim,
15
15
***bin**: a set of binary tools including cachesim, traceConv, etc.
16
-
***traceReader**: a module providing trace parsing and reading, currently supports csv, txt, and binary traces.
17
-
***cache**: it includes three modules --- eviction, admission and prefetching.
18
-
***eviction**: provides a set of cache eviction algorithms such as LRU, LFU, FIFO, CLOCK, ARC, LFUDA (LFU with dynamic aging), SLRU, Hyperbolic, LHD, LeCaR, Cacheus, GLCache, etc.
16
+
***traceReader**: a module providing trace parsing and reading, currently supports csv, txt, and binary traces.
17
+
***cache**: it includes three modules --- eviction, admission and prefetching.
18
+
***eviction**: provides a set of cache eviction algorithms such as LRU, LFU, FIFO, CLOCK, ARC, LFUDA (LFU with dynamic aging), SLRU, Hyperbolic, LHD, LeCaR, Cacheus, GLCache, etc.
19
19
***admission**: provides a set of admission algorithms including size, bloomFilter, adaptSize.
20
-
***prefetch**: provides various prefetch algorithms, currently it is not used.
20
+
***prefetch**: provides various prefetch algorithms, currently it is not used.
The common_cache_params is a `common_cache_params_t` struct, the hashpower is the estimated size of hash table, default is 24, which means default hash table size is `1 << 24` (16777216) objects. Note that setting an appropriate
45
45
```c
@@ -49,7 +49,7 @@ typedef struct {
49
49
int hashpower;
50
50
} common_cache_params_t;
51
51
```
52
-
Note that setting an appropriate hashpower can reduce the number of times hash table expands, but only set it if you know what you doing, otherwise, leave it as the default.
52
+
Note that setting an appropriate hashpower can reduce the number of times hash table expands, but only set it if you know what you doing, otherwise, leave it as the default.
53
53
54
54
#### Close/free the cache
55
55
```c
@@ -58,7 +58,7 @@ cache->cache_free(cache);
58
58
```
59
59
60
60
#### Cache get
61
-
This is the highest level cache API, which tries to find the object in the cache. If found, it updates the cache state (e.g., moving the object to the head of queue in LRU); otherwise, it inserts the object in the cache, and evict if necessary.
61
+
This is the highest level cache API, which tries to find the object in the cache. If found, it updates the cache state (e.g., moving the object to the head of queue in LRU); otherwise, it inserts the object in the cache, and evict if necessary.
62
62
```c
63
63
// req is the request, see the next section for reading from a trace
64
64
cache->get(cache, req);
@@ -67,30 +67,30 @@ cache->get(cache, req);
67
67
The APIs below is lower level API, if you use the lower level API, you need to explicitly update the `n_req` field of the cache after each user request, otherwise, some algorithms that rely on virtual time may not work correctly.
68
68
69
69
#### Cache find
70
-
This is the lower level cache API, which tries to find the object in the cache. If found, it updates the cache state if `update_cache` is true, and return the found object; otherwise, it returns NULL.
70
+
This is the lower level cache API, which tries to find the object in the cache. If found, it updates the cache state if `update_cache` is true, and return the found object; otherwise, it returns NULL.
71
71
```c
72
72
cache->find(cache, req, update_cache);
73
73
```
74
74
75
75
#### Cache insert
76
-
This is the lower level cache API, which tries to insert the object in the cache. If the object can be inserted into the cache, it returns the inserted object. Otherwise, it returns NULL.
76
+
This is the lower level cache API, which tries to insert the object in the cache. If the object can be inserted into the cache, it returns the inserted object. Otherwise, it returns NULL.
77
77
78
-
Note that there are cases that the object is not inserted into the cache, e.g., the object is too large to fit in the cache.
78
+
Note that there are cases that the object is not inserted into the cache, e.g., the object is too large to fit in the cache.
79
79
80
-
Because this is the second level API, this function does not perform eviction and assumes the cache has enough space.
81
-
If using this function, you need to explicitly call `evict` to evict objects.
80
+
Because this is the second level API, this function does not perform eviction and assumes the cache has enough space.
81
+
If using this function, you need to explicitly call `evict` to evict objects.
82
82
```c
83
83
cache->insert(cache, req);
84
84
```
85
85
86
86
#### Cache evict
87
-
This is the lower level cache API, which tries to evict the object in the cache. If the object can be evicted from the cache, it returns the evicted object. Otherwise, it returns NULL.
87
+
This is the lower level cache API, which tries to evict the object in the cache. If the object can be evicted from the cache, it returns the evicted object. Otherwise, it returns NULL.
88
88
```c
89
89
cache->evict(cache, req);
90
90
```
91
91
92
92
#### Cache remove
93
-
This is the lower level cache API, which tries to remove the object in the cache. If the object is in the cache and can be removed, it returns true. Otherwise, it returns false.
93
+
This is the lower level cache API, which tries to remove the object in the cache. If the object is in the cache and can be removed, it returns true. Otherwise, it returns false.
94
94
Note that this function should not be used for eviction purpose.
0 commit comments