Bug report
Bug description:
In Tachyon profiler TUI, pressing r (reset) clears all collected stats except the aggregated opcode data.
That's because LiveStatsCollector.reset_stats() clears all results, per-thread data and all counters, but not self.opcode_stats.
It can be seen that with --opcodes, the opcode panel keeps running and incrementing the values while every other panel starts from zero.
Short repro with no TUI:
from types import SimpleNamespace
from profiling.sampling.live_collector import LiveStatsCollector
collector = LiveStatsCollector(1000, opcodes=True)
frame = SimpleNamespace(filename="t.py", location=5, funcname="f", opcode=83)
collector.process_frames([frame])
collector.reset_stats()
print(dict(collector.result)) # empty as expected
print(dict(collector.opcode_stats)) # should be empty but isn't: {('t.py', 5, 'f'): defaultdict(<class 'int'>, {83: 1})}
I think that reset_stats() (b338308) predates the opcode tracking (5b19c75) and it was accidentally skipped.
This should be a simple fix plus a test adjustment, I have it ready.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs
Bug report
Bug description:
In Tachyon profiler TUI, pressing
r(reset) clears all collected stats except the aggregated opcode data.That's because
LiveStatsCollector.reset_stats()clears all results, per-thread data and all counters, but notself.opcode_stats.It can be seen that with
--opcodes, the opcode panel keeps running and incrementing the values while every other panel starts from zero.Short repro with no TUI:
I think that
reset_stats()(b338308) predates the opcode tracking (5b19c75) and it was accidentally skipped.This should be a simple fix plus a test adjustment, I have it ready.
CPython versions tested on:
CPython main branch
Operating systems tested on:
macOS
Linked PRs