Skip to content

Commit 161edc2

Browse files
committed
update
1 parent bfffa02 commit 161edc2

5 files changed

Lines changed: 46 additions & 147 deletions

File tree

libCacheSim/cache/eviction/QDLP.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ cache_t *QDLP_init(const common_cache_params_t ccache_params,
127127
params->main_cache = LHD_init(ccache_params_local, NULL);
128128
} else if (strcasecmp(params->main_cache_type, "clock") == 0) {
129129
params->main_cache = Clock_init(ccache_params_local, NULL);
130+
} else if (strcasecmp(params->main_cache_type, "sieve") == 0) {
131+
params->main_cache = Sieve_init(ccache_params_local, NULL);
130132
} else if (strcasecmp(params->main_cache_type, "clock2") == 0) {
131133
params->main_cache = Clock_init(ccache_params_local, "n-bit-counter=2");
132134
} else if (strcasecmp(params->main_cache_type, "clock3") == 0) {

libCacheSim/cache/eviction/priv/S3FIFO.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ typedef struct {
4949
} S3FIFO_params_t;
5050

5151
static const char *DEFAULT_CACHE_PARAMS =
52-
"fifo-size-ratio=0.10,ghost-size-ratio=0.90,move-to-main-threshold=1";
52+
"fifo-size-ratio=0.10,ghost-size-ratio=0.90,move-to-main-threshold=2";
5353

5454
// ***********************************************************************
5555
// **** ****
File renamed without changes.

scripts/mrc_size.py

Lines changed: 43 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -75,18 +75,39 @@ def run_cachesim(datapath,
7575
return mrc_dict
7676

7777

78-
def plot_mrc(mrc_dict, name="mrc"):
78+
def plot_mrc(mrc_dict, ignore_obj_size=1, name="mrc"):
7979
linestyles = itertools.cycle(["-", "--", "-.", ":"])
80+
markers = itertools.cycle([
81+
"o", "v", "^", "<", ">", "s", "p", "P", "*", "h", "H", "+", "x", "X",
82+
"D", "d", "|", "_"
83+
])
8084
# colors = itertools.cycle(["r", "g", "b", "c", "m", "y", "k"])
8185

86+
size_unit, size_unit_str = 1, "B"
87+
first_size = int(list(mrc_dict.values())[0][0][0])
88+
if first_size > 1024 * 1024 * 1024:
89+
size_unit = 1024 * 1024 * 1024
90+
size_unit_str = "GiB"
91+
elif first_size > 1024 * 1024:
92+
size_unit = 1024 * 1024
93+
size_unit_str = "MiB"
94+
elif first_size > 1024:
95+
size_unit = 1024
96+
size_unit_str = "KiB"
97+
8298
for algo, mrc in mrc_dict.items():
8399
print(mrc)
84-
plt.plot([x[0] for x in mrc], [x[1] for x in mrc],
100+
plt.plot([x[0] / size_unit for x in mrc], [x[1] for x in mrc],
85101
linewidth=2,
102+
# marker=next(markers),
103+
# markersize=1,
86104
linestyle=next(linestyles),
87105
label=algo)
88106

89-
plt.xlabel("Cache Size")
107+
if ignore_obj_size:
108+
plt.xlabel("Cache Size")
109+
else:
110+
plt.xlabel("Cache Size ({})".format(size_unit_str))
90111
plt.xscale("log")
91112
plt.ylabel("Miss Ratio")
92113
plt.legend()
@@ -99,20 +120,22 @@ def plot_mrc(mrc_dict, name="mrc"):
99120
def run():
100121
import glob
101122

102-
algos = "lru,slru,arc,lirs,lhd,tinylfu,qdlpv1"
123+
algos = "lru,slru,arc,lirs,lhd,tinylfu,s3fifo"
103124
algos = "lru,arc,sieve,lrb"
104125
cache_sizes = ""
105-
for i in range(1, 100, 2):
106-
cache_sizes += str(i / 100.0) + ","
107-
cache_sizes = cache_sizes[:-1]
126+
cache_sizes = "0.01,0.02,0.05,0.075,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.5,0.6,0.7,0.8"
127+
cache_sizes = "0.05,0.075,0.1,0.15,0.2,0.25,0.3,0.4,0.5,0.6,0.7,0.8"
108128
print(cache_sizes)
109129

110130
for tracepath in glob.glob("/disk/data/*.zst"):
111131
dataname = tracepath.split("/")[-1].replace(
112132
".oracleGeneral", "").replace(".sample10",
113133
"").replace(".bin",
114134
"").replace(".zst", "")
115-
mrc_dict = run_cachesim(tracepath, algos, cache_sizes, ignore_obj_size=0)
135+
mrc_dict = run_cachesim(tracepath,
136+
algos,
137+
cache_sizes,
138+
ignore_obj_size=0)
116139
with open("{}.mrc".format(dataname), "wb") as f:
117140
pickle.dump(mrc_dict, f)
118141
plot_mrc(mrc_dict, dataname)
@@ -123,34 +146,30 @@ def run():
123146
# print("Usage: python3 {} <datapath> <algos> <cache_sizes>".format(sys.argv[0]))
124147
# exit(1)
125148
# tracepath = "/disk/data/w96.oracleGeneral.bin.zst"
126-
tracepath = "/disk/data/wiki_2016u.oracleGeneral.sample10.zst"
127-
# tracepath = "/mntData2/oracleReuse/msr/src1_0.IQI.bin.oracleGeneral.zst"
128-
# tracepath = "/mntData2/oracleReuse/msr/src1_1.IQI.bin.oracleGeneral.zst"
149+
tracepath = "/disk/data/wiki_2019t.oracleGeneral.sample10.zst"
150+
tracepath = "/disk/wiki2018.oracleGeneral.sample10"
129151
algos = "lru,arc,sieve,lrb"
130152
cache_sizes = "0"
153+
cache_sizes = "0.01,0.02,0.05,0.075,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.6,0.8"
154+
# cache_sizes = "0.05,0.075,0.1,0.15,0.2,0.25,0.3,0.35,0.4,0.6,0.8"
131155
else:
132156
tracepath = sys.argv[1]
133157
algos = sys.argv[2]
134158
cache_sizes = sys.argv[3]
135159

136-
if cache_sizes == "0":
137-
cache_sizes = ""
138-
for i in range(1, 100, 2):
139-
cache_sizes += str(i / 100.0) + ","
140-
cache_sizes = cache_sizes[:-1]
160+
# run()
141161

142-
run()
143-
144-
dataname = tracepath.split("/")[-1].split(".")[0]
145-
if os.path.exists("{}.mrc".format(dataname)):
146-
with open("{}.mrc".format(dataname), "rb") as f:
147-
mrc_dict = pickle.load(f)
162+
dataname = tracepath.split("/")[-1].split(".")[0] + ".sample10"
163+
if os.path.exists("{}.mrc.pickle".format(dataname)):
164+
print("Load result from {}".format("{}.mrc.pickle".format(dataname)))
165+
with open("{}.mrc.pickle".format(dataname), "rb") as f:
166+
mrc_dict = pickle.load(f)
148167
else:
149168
mrc_dict = run_cachesim(tracepath,
150169
algos,
151170
cache_sizes,
152171
ignore_obj_size=0)
153-
with open("{}.mrc".format(dataname), "wb") as f:
172+
with open("{}.mrc.pickle".format(dataname), "wb") as f:
154173
pickle.dump(mrc_dict, f)
155174

156-
plot_mrc(mrc_dict, dataname)
175+
plot_mrc(mrc_dict, ignore_obj_size=0, name=dataname)

scripts/plot_sieve.py

Lines changed: 0 additions & 122 deletions
This file was deleted.

0 commit comments

Comments
 (0)