Skip to content

Tachyon flamegraph: Total time displayed is affected by sampling rate #154059

Description

@JostMigenda

Bug report

Bug description:

As discussed with @pablogsal during EuroPython sprints:

The hover views in Tachyon’s flamegraph format show incorrect values for the total time. Using this simple example script (flamegraph_demo.py):

import time

def main():
    f_1()
    f_2()

def f_1():
    time.sleep(0.5)

def f_2():
    time.sleep(1)

main()
python -m profiling.sampling run --flamegraph --browser flamegraph_demo.py

generates the following output:
Image

The time displayed in the sidebar is correct; but hovering over the flamegraph shows an incorrect “Total time”.

Additional notes:

  • The total time displayed is proportional to the sampling rate; e.g., when running with -r 10kHz (instead of the default 1kHz above), the “Total time” is displayed as 15 ms instead of 1.50 ms.
  • This issue is specific to the --flamegraph output format; using --gecko gives correct values.
  • All tested in 3.15.0b4.

CPython versions tested on:

3.15

Operating systems tested on:

macOS

Linked PRs

Metadata

Metadata

Assignees

No one assigned

    Labels

    stdlibStandard Library Python modules in the Lib/ directorytopic-profilingtype-bugAn unexpected behavior, bug, or error

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions