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

Add ability to pass multiple profiles which are merged in call to #99

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

marvingreenberg
Copy link

pstat.Stats().  This is a common use case when multiple runs generate
multiple '.prof' files, e.g. snakeviz prog1.*.prof

When multiple profiles are passed, the "display_name" which is used
for the browser tab name is changed to "Multiple profiles"

This change allows running snakeviz with multiple profiles. It simply concatenates the multiple profiles to the URL with a '&' separator, which is a bit of a hack and MAY fail with some browsers if a HUGE number of profiles is passed. But it works for me with testing on chrome and safari.

pstat.Stats().  This is a common use case when multiple runs generate
multiple '.prof' files, e.g. snakeviz prog1.*.prof

When multiple profiles are passed, the "display_name" which is used
for the browser tab name is changed to "Multiple profiles"
@marvingreenberg
Copy link
Author

Various alternatives to passing the horrible URL are possible, including much fancier things like having the cli create a "fred.viz" file like
{'profiles':['/Users/fred/foo.12765217.prof', '/Users/fred/foo.17537333.prof'],
'description':'Multiple profiles'}

Then the URL would be 127.0.0.1:8080/snakeviz/fred.viz - making a prettier URL and giving a place to store more state like color information or other stuff that annoying users request.

@jiffyclub
Copy link
Owner

Thanks for this PR, hope to give it a review soon!

@marvingreenberg
Copy link
Author

I realize that I have specific code using cProfile.run to generate uniquely named profile files. I use an environment variable to set a PROFILE_DIR to collect the dozens or hundreds of generated profile files.

@StevenBaby
Copy link

StevenBaby commented Nov 18, 2018

this function i also wanted.

@jiffyclub
Copy link
Owner

Hi, sorry for taking so long to review this! I love the idea, but looks like it now conflicts with work done on the cli in meantime, probably when support was added for listing directories. If you'd like to try to update this I'd love that, or if you'd like I can take a crack at implementing this feature. I think I would probably go about it by merging the profiles in a temporary file and then pointing snakeviz at that. How does that sound?

@marvingreenberg
Copy link
Author

This fell off my radar a while ago. I can look at my patch and see what I can do, but not any time too soon I think. Or you could think about the problem - the basic idea shouldn't be too hard duplicate.

@Greyvend
Copy link

Why is this still in a review? This functionality is very much anticipated.

@lucidyan
Copy link

Very sad that this functionality is still in development after 4 years.

@MichaelSuen-thePointer
Copy link

MichaelSuen-thePointer commented Jan 18, 2024

Anyone can approve this PR please?

JUST MERGE IT, leave it to the community if you have no time!!!

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.

6 participants