-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathtest_analyzer.py
More file actions
50 lines (42 loc) · 1.93 KB
/
test_analyzer.py
File metadata and controls
50 lines (42 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
from libcachesim import TraceAnalyzer, TraceReader, AnalysisOption, AnalysisParam
import os
import pytest
def test_analyzer_common():
"""
Test the trace analyzer functionality.
"""
# Add debugging and error handling
URI = "s3://cache-datasets/cache_dataset_oracleGeneral/2007_msr/msr_hm_0.oracleGeneral.zst"
reader = TraceReader(trace=URI)
# For this specific small dataset (only 4 objects), configure analysis options more conservatively
# to avoid bounds issues with the analysis modules
analysis_option = AnalysisOption(
req_rate=True, # Keep basic request rate analysis
access_pattern=False, # Disable access pattern analysis
size=True, # Keep size analysis
reuse=False, # Disable reuse analysis for small datasets
popularity=False, # Disable popularity analysis for small datasets (< 200 objects)
ttl=False, # Disable TTL analysis
popularity_decay=False, # Disable popularity decay analysis
lifetime=False, # Disable lifetime analysis
create_future_reuse_ccdf=False, # Disable experimental features
prob_at_age=False, # Disable experimental features
size_change=False, # Disable size change analysis
)
# Set track_n_popular and track_n_hit to small values suitable for this dataset
analysis_param = AnalysisParam(
track_n_popular=4, # Match the actual number of objects
track_n_hit=4, # Match the actual number of objects
)
analyzer = TraceAnalyzer(
reader, "TestAnalyzerResults", analysis_option=analysis_option, analysis_param=analysis_param
)
analyzer.run()
# Clean file after test, match all files with the prefix "TestAnalyzerResults"
for file in os.listdir("."):
if file.startswith("TestAnalyzerResults"):
os.remove(file)
# Remove file named "stat"
stat_file = "stat"
if os.path.exists(stat_file):
os.remove(stat_file)