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

Customisation of flame-graph parameters #45

Open
3tilley opened this issue Sep 23, 2018 · 5 comments
Open

Customisation of flame-graph parameters #45

3tilley opened this issue Sep 23, 2018 · 5 comments
Labels
enhancement New feature or request

Comments

@3tilley
Copy link

3tilley commented Sep 23, 2018

The default setting to make the flame-graph are pretty good, but it would be nice to be able to flex them. Things I'd like to be able to do:

  • Adjust the size of the output svg
  • Remove some layers of the call stack from the output (see the attached svg for pytest on a simple python test)
  • Use different colour schemes
  • List absolute time instead of number of samples

I can think of three ways to do this:

  1. Expose the output of the profiler before it goes into flame, a custom call to the flame-script could then be executed by the user
  2. Allow a dictionary of command line arguments to be given to py-spy and passed on
  3. Pass a command-line config file

I have not used Rust before, but I could perhaps implement this change given some direction. FWIW I think the second is probably the best option, even if it is a little hacky.

pytest_flame

@DavidVentura
Copy link

DavidVentura commented Sep 24, 2018

A nice feature would be to be able to include/exclude filenames, for example only render files whose path starts with MYPACKAGENAME/* and then you wouldn't see the stack inside of libraries; I don't really care about what is taking time inside of redis' HGET or json internals (see screenshot)

2018-09-24-104432_1158x172_scrot

edit: or just limit whatever is not included to 1 as maximum depth; in my example you'd only see hget but not execute_command or anything below it

@benfred benfred added the enhancement New feature or request label Sep 24, 2018
@nziebart
Copy link

+1 for approach #1 (exposing intermediate output). I think this is an important primitive

@3tilley
Copy link
Author

3tilley commented Jul 17, 2019

What do you think is the easiest way to expose the options dict in inferno::flamegraph? That would give a lot of bang for buck: svg size, reverse stack order etc. Command line args? Env vars?

@benfred
Copy link
Owner

benfred commented Sep 23, 2019

There is an option to output raw data in v0.2.0 now - you can use this to generate intermediate output to pass to flamegraph.pl with custom options now

@Samreay
Copy link

Samreay commented Mar 29, 2021

I love all the suggestions made so far, especially excluding specific packages, svg size and the colour scheme. Whilst theres now the raw data available, it would be good at a minimum for the main documentation to perhaps include some examples showing how you can achieve any of those customisations if they arent available within pyspy itself. Though having the ability to pass args from py-spy to flamegraph.pl would be fantastic. @benfred - thoughts on this? py-spy is my favourite profiler because of how simple it is it get high quality and useful output, and I'm leery of trying to complicate that ease-of-use too much by adding extra steps for users fi they want to tweak things.

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

No branches or pull requests

5 participants