Skip to content

TRACY_NO_CALLSTACK doesn't prevent context switches / wait events callchain collection #1419

Description

@ALTree

I'm profiling an embedded application running on a rather weak arm board. All the Tracy stuff is running on core 0, together with other low-priority tasks. I need to collect context switches, and with the amount of data I'm getting, Tracy processing saturates the CPU core; cpu usage is 100%, other tasks cannot run, board becomes unresponsive to ssh. This is both with a localhost collector and with a remote client.

To lower the amount of collected data, I've compiled with

TRACY_NO_CALLSTACK
TRACY_NO_CALLSTACK_INLINES
TRACY_NO_SAMPLING

but I'm still seeing callstacks associated with context switches / wait events. For reference most collected stacks are quite deep (18-20 levels). It appears none of these flags prevent collection of ctx switches stacks; I don't know if this is intentional.

As a test, I've patched Tracy setting pe.sample_max_stack = 1 here and that completely fixed the issue. Still seeing callstack for wait events, but they're only 1 deep; CPU usage is in the 20-30% range, board stays responsive during a profiling run.

A better solution would be to optionally not set PERF_SAMPLE_CALLCHAIN and change the decoder to support that, of course.

Anyway the patch made such a difference in the profiling overhead that I feel it would be useful to either change TRACY_NO_CALLSTACK to also disable ctx switches callstacks, or to add support for a new flag to disable them.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions