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

WIP: don't report subprocess names in SVG output #504

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

smason
Copy link

@smason smason commented Jun 21, 2022

I'd like some way of suppressing subprocess info in the flamegraph/SVG output. This pull-request doesn't expose this option to the user, but seems to do the right thing when I run it.

The motivation is when using the multiprocessing module (e.g. the code below) and hence I don't really care which process the code is running inside, just that it's not in the main one probably. I.e. when running the official version I get n processes that contain basically the same information and hence it seems to make sense to combine them into a single stack. This transformation obviously doesn't make sense if the user is doing different things in each process, but for multiprocessing workloads this cleans up the output a lot.

I think this functionality should be exposed on the command-line somewhere, but wasn't sure how to do that nicely so left that out for the time being.

from multiprocessing import Pool
from time import monotonic

def foo(x):
    t1 = monotonic() + 0.1
    while monotonic() < t1:
        x += sum(range(1024 * 1024))
    return x

def main():
    with Pool() as pool:
        print(pool.map(foo, range(100)))

if __name__ == "__main__":
    main()

I know this is a hack, looking for suggestions around how to pull this option
from the Config
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

Successfully merging this pull request may close these issues.

1 participant