Skip to content

Conversation

@bartlomieju
Copy link

Hi there! Thanks for the great project, we use it extensively at Deno.

While we are working on improving our startup time, we found out that running the target binary just once is not enough to collect reliable data to see where we're spending time. So I added --iterations flag that allows to run target binary multiple times and create a single flamegraph out of all the runs.

This is a quick a dirty implementation, but it allows us to collect more detailed data. If there's an interest in adding this flag and upstreaming the patch I'll be happy to clean it up.

Copy link
Contributor

@djc djc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for contributing these changes!

Looks like CI isn't passing yet, so that needs some work.

# It is not intended for manual editing.
version = 3

[[package]]
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These changes don't belong in this PR, please revert.

}

pub fn generate_flamegraph_for_workload(workload: Workload, opts: Options) -> anyhow::Result<()> {
pub fn generate_flamegraph_for_workload(workload: Workload, opts: Options, iterations: usize) -> anyhow::Result<()> {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it might make sense to store iterations inside Options?


for _i in 0..iterations {
if let Workload::ReadPerf(_perf_file) = &workload {
// pass
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Did you test this with a Workload::ReadPerf scenario? I guess maybe this if needs to be outside this loop, so that we can still pass perf_file to output() (as perf_output)?

@dvdplm
Copy link

dvdplm commented Aug 7, 2024

@djc I am interested in this feature as well, but maybe @bartlomieju got busy in the meantime. Would it be ok if I finished up the PR and got it over the hump?

@djc
Copy link
Contributor

djc commented Aug 8, 2024

@dvdplm sounds good to me. Make sure to retain @bartlomieju as a (co-)author of the commits, and probably good to just squash all commits into a single one.

@bartlomieju
Copy link
Author

Thanks for picking this up, I completely forgot about this PR. I'm gonna close it for now.

@bartlomieju bartlomieju closed this Aug 8, 2024
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.

3 participants