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

[Feature Request] Show Progress #270

Open
lixin-wei opened this issue Jul 6, 2023 · 8 comments
Open

[Feature Request] Show Progress #270

lixin-wei opened this issue Jul 6, 2023 · 8 comments

Comments

@lixin-wei
Copy link

In my case, perf.data is huge(10GB+) and usually takes 30+ min to generate the flame graph.

It will be much more friendly if there is a progress bar.

@lixin-wei lixin-wei changed the title [Feature Requst] Show Progress [Feature Request] Show Progress Jul 6, 2023
@djc
Copy link
Contributor

djc commented Jul 6, 2023

Unfortunately I don't have much time for maintaining flamegraph. Maybe consider submitting a PR?

@lixin-wei
Copy link
Author

Is there any doc about the overall structure/execution path of this project? I'm willing to have a try but don't know where to start.

@djc
Copy link
Contributor

djc commented Jul 6, 2023

No, but it's pretty simple. We get the inferno crate to collapse the data at https://github.com/flamegraph-rs/flamegraph/blob/main/src/lib.rs#L367 and generate the flamegraph at https://github.com/flamegraph-rs/flamegraph/blob/main/src/lib.rs#L427. You should figure which of those is slow. Then, I think you might want to wrap an indicatif thing around the input to either of those things (or both?).

@smoelius
Copy link

smoelius commented Oct 31, 2024

@djc Do these look like the right links? I'm speculating based on the date of your comment:

@smoelius
Copy link

Also, for me, the bottleneck appears to be perf script:

let output = command.output().context("unable to call perf script")?;

Is this surprising to you? (I don't know what this command does.)

@djc
Copy link
Contributor

djc commented Nov 4, 2024

Unless you've specifically enabled --post-process I think you'll want to ignore the if let Some(_) = opts.post_process { .. } block, so I think you'd want to look at the Folder::from(..).collapse(..) block currently around line 395 and the from_reader() call currently around line 455.

I don't know much about perf script, either -- I'm really just here to review/merge PRs that seem correct but otherwise know about as much as a typical user about the inner workings of perf.

If it doesn't work well for you, consider trying samply instead -- it seems to work better on macOS at least, and @mstange is a lot more knowledgeable about perf stuff and profiling in general.

@gth828r
Copy link
Contributor

gth828r commented Nov 7, 2024

This is a problem which I had, so I can probably take a stab at adding this feature. Implementing a true progress bar with perf script is not obvious to me, but I think a spinner with a message about what is running and an elapsed time is a good start, and that is fairly simple to add.

gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 7, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 7, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 7, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 7, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 7, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 7, 2024
@gth828r
Copy link
Contributor

gth828r commented Nov 7, 2024

Ok, after a few different iterations, I found something that I like and it is available as a PR at #343

gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 8, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
gth828r added a commit to gth828r/flamegraph that referenced this issue Nov 11, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses flamegraph-rs#270
djc pushed a commit that referenced this issue Nov 11, 2024
Perf script can take a long time to run. This change adds an indicator
to show that it is running so that the user knows that their application
is not causing the terminal to hang.

Addresses #270
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

4 participants