diff options
author | Mathew Robinson <chasinglogic@gmail.com> | 2019-01-18 07:20:27 -0500 |
---|---|---|
committer | Mathew Robinson <chasinglogic@gmail.com> | 2019-01-18 07:20:27 -0500 |
commit | a99a4dc99354a8439cb8f9d088d2a7946048b4c7 (patch) | |
tree | 666f8b8963dbbb0786e0725d015dbb5e755336e9 /SConstruct | |
parent | 1802707307b29b4cb0ee1459509fda5a5d87db6c (diff) | |
download | mongo-cache-stats.tar.gz |
WIP: make stats reporting run after buildcache-stats
Diffstat (limited to 'SConstruct')
-rw-r--r-- | SConstruct | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/SConstruct b/SConstruct index 35c3ba191be..40043c5002c 100644 --- a/SConstruct +++ b/SConstruct @@ -3864,3 +3864,18 @@ env.Alias('cache-prune', cachePrune) # because SCons wants it to be a particular object. for i, s in enumerate(BUILD_TARGETS): BUILD_TARGETS[i] = env.subst(s) + +def print_cache_stats(): + from SCons.Node.FS import cache_hits + from SCons.Node.FS import cache_requests + if cache_requests == 0: + print('No cache requests were made.') + return + + ratio = (float(cache_hits) / float(cache_requests)) * 100.0 + print('Cache cache_hits: %d', cache_hits) + print('Cache cache_requests: %d', cache_requests) + print('Cache hit ratio: %d%%', ratio) + +import atexit +atexit.register(print_cache_stats) |