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] feat: add --iterations flags to specify how many times to run target binary #255

Open
wants to merge 3 commits into
base: main
Choose a base branch
from

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.

@@ -2,6 +2,12 @@
# 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.

@@ -316,7 +316,7 @@ fn print_command(cmd: &Command, verbose: bool) {
}
}

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)?

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.

None yet

2 participants