mirror of
https://github.com/ltcptgeneral/cs239-caching.git
synced 2025-04-04 05:23:26 +00:00
changed prefetch test
This commit is contained in:
parent
db002dbdd0
commit
b865e3e168
@ -32,6 +32,7 @@ hits = []
|
|||||||
|
|
||||||
start = time.time()
|
start = time.time()
|
||||||
curr_user = generate_random()
|
curr_user = generate_random()
|
||||||
|
last_user = curr_user
|
||||||
for i in tqdm(range(10000)):
|
for i in tqdm(range(10000)):
|
||||||
url = baseurl + "/user/" + curr_user
|
url = baseurl + "/user/" + curr_user
|
||||||
response = requests.get(url)
|
response = requests.get(url)
|
||||||
@ -39,9 +40,10 @@ for i in tqdm(range(10000)):
|
|||||||
times.append(content["time_ms"])
|
times.append(content["time_ms"])
|
||||||
hits.append(content["source"] == "cache")
|
hits.append(content["source"] == "cache")
|
||||||
if fetch_friend(chance_of_selecting_friend):
|
if fetch_friend(chance_of_selecting_friend):
|
||||||
curr_user = generate_random_friend(curr_user)
|
curr_user = generate_random_friend(last_user)
|
||||||
else:
|
else:
|
||||||
curr_user = generate_random()
|
curr_user = generate_random()
|
||||||
|
last_user = curr_user
|
||||||
end = time.time()
|
end = time.time()
|
||||||
|
|
||||||
print_report(hits, times, end - start)
|
print_report(hits, times, end - start)
|
Loading…
x
Reference in New Issue
Block a user