Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Lib/profiling/sampling/live_collector/collector.py
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,7 @@ def build_stats_list(self):
def reset_stats(self):
"""Reset all collected statistics."""
self.result.clear()
self.opcode_stats.clear()
self.per_thread_data.clear()
self.thread_ids.clear()
self.view_mode = "ALL"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ def test_reset_stats(self):
"cumulative_calls": 75,
"total_rec_calls": 0,
}
self.collector.opcode_stats[("test.py", 1, "func")][100] = 5

# Reset
self.collector.reset_stats()
Expand All @@ -107,6 +108,7 @@ def test_reset_stats(self):
self.assertEqual(self.collector.successful_samples, 0)
self.assertEqual(self.collector.failed_samples, 0)
self.assertEqual(len(self.collector.result), 0)
self.assertEqual(len(self.collector.opcode_stats), 0)

def test_increase_refresh_rate(self):
"""Test increasing refresh rate (faster updates)."""
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
Fix the live sampling profiler TUI keeping stale aggregated opcode
statistics after a stats reset.
Loading