MCPcopy Create free account
hub / github.com/FastLED/FastLED / show_zccache_stats

Function show_zccache_stats

ci/util/zccache_config.py:75–180  ·  view source on GitHub ↗

Display zccache statistics if zccache is available.

()

Source from the content-addressed store, hash-verified

73
74
75def show_zccache_stats() -> None:
76 """Display zccache statistics if zccache is available."""
77 zccache_path = get_zccache_wrapper_path()
78 if not zccache_path:
79 return
80
81 # Query per-session stats then end the session
82 session_id = os.environ.get("ZCCACHE_SESSION_ID", "")
83 if session_id and zccache_path:
84 try:
85 stats_result = RunningProcess.run(
86 [zccache_path, "session-stats", session_id],
87 cwd=None,
88 check=False,
89 timeout=10,
90 capture_output=True,
91 text=True,
92 )
93 # session-stats may print to stdout or stderr
94 output = (stats_result.stderr or "").strip() or (
95 stats_result.stdout or ""
96 ).strip()
97 if stats_result.returncode == 0 and output:
98 ts_print("\nZCCACHE session stats:")
99 for line in output.split("\n"):
100 ts_print(f" {line.strip()}")
101 except KeyboardInterrupt as ki:
102 handle_keyboard_interrupt(ki)
103 raise
104 except Exception:
105 pass # Non-fatal
106 try:
107 RunningProcess.run(
108 [zccache_path, "session-end", session_id],
109 cwd=None,
110 check=False,
111 timeout=10,
112 capture_output=True,
113 )
114 except KeyboardInterrupt as ki:
115 handle_keyboard_interrupt(ki)
116 raise
117 except Exception:
118 pass # Non-fatal
119
120 try:
121 result = RunningProcess.run(
122 [zccache_path, "status"],
123 cwd=None,
124 check=False,
125 timeout=10,
126 capture_output=True,
127 )
128 if result.returncode == 0:
129 # Parse zccache status output format:
130 # Compilations: N total (X cached, Y cold, Z non-cacheable)
131 # Hit rate: XX.X%
132 lines = result.stdout.strip().split("\n")

Callers 3

run_qemu_testsFunction · 0.90
run_avr8js_testsFunction · 0.90
runnerFunction · 0.90

Calls 5

ts_printFunction · 0.90
get_zccache_wrapper_pathFunction · 0.85
getMethod · 0.45
runMethod · 0.45

Tested by 1

runnerFunction · 0.72