Skip to content

LiveStatsCollector (Tachyon): reset_stats() does not clear aggregated opcode statistics #153293

Closed

Description

@lkk7

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

Activity

  1. added
    type-bugAn unexpected behavior, bug, or error
    on Jul 7, 2026
  2. added a commit that references this issue on Jul 7, 2026
  3. changed the title [-]`LiveStatsCollector`: `reset_stats()` does not clear aggregated opcode statistics[/-] [+]`LiveStatsCollector` (Tachyon): `reset_stats()` does not clear aggregated opcode statistics[/+] on Jul 7, 2026
  4. added
    stdlibStandard Library Python modules in the Lib/ directory
    3.15bugs and security fixes
    3.16new features, bugs and security fixes
    on Jul 7, 2026
  5. added a commit that references this issue on Jul 11, 2026
  6. added a commit that references this issue on Jul 11, 2026
  7. bebereina-coder commented on Jul 20, 2026

    @bebereina-coder
  8. bebereina-coder commented on Jul 20, 2026

    @bebereina-coder

    import os

    Define la ruta y las carpetas que quieres crear

    ruta_principal = os.path.join(os.path.expanduser("~"), "Music", "Mi_Nueva_Lista")
    subcarpetas = ["01_Electro", "02_House", "03_Tech_House", "04_Hits"]

    for carpeta in subcarpetas:
    ruta_completa = os.path.join(ruta_principal, carpeta)
    os.makedirs(ruta_completa, exist_ok=True)
    print(f"Carpeta creada: {ruta_completa}")

  9. bebereina-coder commented on Jul 20, 2026

    @bebereina-coder

    import os

    Define la ruta y las carpetas que quieres crear

    ruta_principal = os.path.join(os.path.expanduser("~"), "Music", "Mi_Nueva_Lista")
    subcarpetas = ["01_Electro", "02_House", "03_Tech_House", "04_Hits"]

    for carpeta in subcarpetas:
    ruta_completa = os.path.join(ruta_principal, carpeta)
    os.makedirs(ruta_completa, exist_ok=True)
    print(f"Carpeta creada: {ruta_completa}")

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    3.15bugs and security fixes3.16new features, bugs and security fixesstdlibStandard Library Python modules in the Lib/ directorytopic-profilingtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions