mirror of
https://gitlab.com/ita1024/waf.git
synced 2024-11-22 18:07:12 +01:00
Merge branch 'wafcache_stats_multiple_bld' into 'master'
wafcache: support stats also for multiple build commands See merge request ita1024/waf!2334
This commit is contained in:
commit
51fa39db69
@ -258,6 +258,19 @@ def build(bld):
|
|||||||
"""
|
"""
|
||||||
Called during the build process to enable file caching
|
Called during the build process to enable file caching
|
||||||
"""
|
"""
|
||||||
|
if WAFCACHE_STATS:
|
||||||
|
# Init counter for statistics and hook to print results at the end
|
||||||
|
bld.cache_reqs = bld.cache_hits = bld.cache_puts = 0
|
||||||
|
|
||||||
|
def printstats(bld):
|
||||||
|
hit_ratio = 0
|
||||||
|
if bld.cache_reqs > 0:
|
||||||
|
hit_ratio = (bld.cache_hits / bld.cache_reqs) * 100
|
||||||
|
Logs.pprint('CYAN', ' wafcache stats: requests: %s, hits, %s, ratio: %.2f%%, writes %s' %
|
||||||
|
(bld.cache_reqs, bld.cache_hits, hit_ratio, bld.cache_puts) )
|
||||||
|
|
||||||
|
bld.add_post_fun(printstats)
|
||||||
|
|
||||||
if process_pool:
|
if process_pool:
|
||||||
# already called once
|
# already called once
|
||||||
return
|
return
|
||||||
@ -273,19 +286,6 @@ def build(bld):
|
|||||||
for x in reversed(list(Task.classes.values())):
|
for x in reversed(list(Task.classes.values())):
|
||||||
make_cached(x)
|
make_cached(x)
|
||||||
|
|
||||||
if WAFCACHE_STATS:
|
|
||||||
# Init counter for statistics and hook to print results at the end
|
|
||||||
bld.cache_reqs = bld.cache_hits = bld.cache_puts = 0
|
|
||||||
|
|
||||||
def printstats(bld):
|
|
||||||
hit_ratio = 0
|
|
||||||
if bld.cache_reqs > 0:
|
|
||||||
hit_ratio = (bld.cache_hits / bld.cache_reqs) * 100
|
|
||||||
Logs.pprint('CYAN', ' wafcache stats: requests: %s, hits, %s, ratio: %.2f%%, writes %s' %
|
|
||||||
(bld.cache_reqs, bld.cache_hits, hit_ratio, bld.cache_puts) )
|
|
||||||
|
|
||||||
bld.add_post_fun(printstats)
|
|
||||||
|
|
||||||
def cache_command(sig, files_from, files_to):
|
def cache_command(sig, files_from, files_to):
|
||||||
"""
|
"""
|
||||||
Create a command for cache worker processes, returns a pickled
|
Create a command for cache worker processes, returns a pickled
|
||||||
|
Loading…
Reference in New Issue
Block a user