Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Warn for low sample counts #318

Open
brendangregg opened this issue Oct 28, 2023 · 1 comment
Open

Warn for low sample counts #318

brendangregg opened this issue Oct 28, 2023 · 1 comment

Comments

@brendangregg
Copy link
Owner

Just posting this idea before I forget it. The first thing I look at in a CPU flame graph is the sample count, as if it's low (e.g., <100) then something likely went wrong based on the common frequency of CPU profiling. This happens when the workload stops but the end user doesn't realize it, and they create a flame graph of an idle system by mistake, but still don't realize it and spend time examining idle initialization and kernel code paths.

The idea is to at least print a warning during flame graph generation about low sample counts, e.g., using the warn function:

my $stackcount = scalar @Data;
warn "Stack count is low ($stackcount) did something go wrong?\n" if $stackcount < 100;

Maybe it should be visible in the SVG too? Would have to play with it to see. Note that not all flame graphs are CPU stack samples, some are time based where it's more plausible to have fewer than 100 unique stacks. Maybe we can tell the two apart by seeing if --countname option was used.

@matthew-olson-intel
Copy link
Contributor

OK, I implemented this in #321. Pretty simple implementation, but I made one small modification: instead of warning on the number of stacks, it warns on the total number of samples.

I could see this being improved slightly by also warning in the SVG: this could be done by modifying $samples_txt further down to include a warning.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants