summaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorMathew Robinson <chasinglogic@gmail.com>2019-05-15 17:29:48 (GMT)
committerMathew Robinson <chasinglogic@gmail.com>2019-05-17 17:36:01 (GMT)
commitdf0db6cecf595a8a8819ffd97e38f9e04de249da (patch)
tree1e30389ecd8d20ac20f3b3d20af9711261bff5c6 /test
parent3cd0e6afa59e1a380bb028695f1817b1d951aefb (diff)
downloadSCons-df0db6cecf595a8a8819ffd97e38f9e04de249da.zip
SCons-df0db6cecf595a8a8819ffd97e38f9e04de249da.tar.gz
SCons-df0db6cecf595a8a8819ffd97e38f9e04de249da.tar.bz2
Add cache hit rate to cache debugging
Diffstat (limited to 'test')
-rw-r--r--test/CacheDir/debug.py20
-rw-r--r--test/Interactive/cache-debug.py1
2 files changed, 21 insertions, 0 deletions
diff --git a/test/CacheDir/debug.py b/test/CacheDir/debug.py
index 16f4702..9b3b633 100644
--- a/test/CacheDir/debug.py
+++ b/test/CacheDir/debug.py
@@ -88,9 +88,13 @@ test.run(chdir='src',
expect = \
r"""CacheRetrieve\(aaa.out\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(bbb.out\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(ccc.out\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(all\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
"""
test.must_match(debug_out, expect, mode='r')
@@ -102,17 +106,25 @@ test.must_match(debug_out, expect, mode='r')
expect = \
r"""CacheRetrieve\(aaa.out\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
cat\(\["aaa.out"\], \["aaa.in"\]\)
CachePush\(aaa.out\): pushing to [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(bbb.out\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
cat\(\["bbb.out"\], \["bbb.in"\]\)
CachePush\(bbb.out\): pushing to [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(ccc.out\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
cat\(\["ccc.out"\], \["ccc.in"\]\)
CachePush\(ccc.out\): pushing to [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(all\): [0-9a-fA-F]+ not in cache
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
cat\(\["all"\], \["aaa.out", "bbb.out", "ccc.out"\]\)
CachePush\(all\): pushing to [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
"""
test.run(chdir='src',
@@ -134,12 +146,16 @@ test.unlink(['src', 'cat.out'])
expect = \
r"""Retrieved `aaa.out' from cache
CacheRetrieve\(aaa.out\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
Retrieved `bbb.out' from cache
CacheRetrieve\(bbb.out\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
Retrieved `ccc.out' from cache
CacheRetrieve\(ccc.out\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
Retrieved `all' from cache
CacheRetrieve\(all\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
"""
test.run(chdir='src',
@@ -164,9 +180,13 @@ test.run(chdir='src',
expect = \
r"""CacheRetrieve\(aaa.out\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(bbb.out\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(ccc.out\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
CacheRetrieve\(all\): retrieving from [0-9a-fA-F]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
"""
test.must_match(debug_out, expect, mode='r')
diff --git a/test/Interactive/cache-debug.py b/test/Interactive/cache-debug.py
index 68bedb8..e1856bb 100644
--- a/test/Interactive/cache-debug.py
+++ b/test/Interactive/cache-debug.py
@@ -106,6 +106,7 @@ scons>>> Removed foo.out
scons>>> Touch\("4"\)
scons>>> Retrieved `foo.out' from cache
CacheRetrieve\(foo.out\): retrieving from [0-9A-za-z]+
+requests: [0-9]+, hits: [0-9]+, misses: [0-9]+, hit rate: [0-9]+\.[0-9]{2,}%
scons>>> Touch\("5"\)
scons>>>
"""