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

Give helpful hint if sampling frequency isn't prime #9

Merged
merged 6 commits into from
Apr 16, 2024

Conversation

gmarler
Copy link
Collaborator

@gmarler gmarler commented Apr 6, 2024

Currently, we exit with error if the --sample-freq option is provided with a non-prime number.

This prevents accidentally sampling at rates that could collide with other system events more easily, leading to unintended feedback.

But, it doesn't help the user know what numbers they should have picked.

This PR adjusts the error message to include the prime numbers below and above the sampling rate that was requested.

@javierhonduco
Copy link
Owner

This looks good but do you mind separating it in one PR per feature, perhaps one for the primes, one for the new argument, etc?

src/main.rs Outdated
@@ -105,6 +105,9 @@ struct Cli {
/// Output file for Flame Graph in SVG format
#[arg(long, default_value = "flame.svg")]
flamegraph_file: PathBuf,
/// Enable eBPF debug output
#[arg(long, action=ArgAction::SetFalse)]
Copy link
Owner

Choose a reason for hiding this comment

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

nit: this is not the BPF logs but the libbpf ones

@gmarler
Copy link
Collaborator Author

gmarler commented Apr 16, 2024

This looks good but do you mind separating it in one PR per feature, perhaps one for the primes, one for the new argument, etc?

Sure thing - I've reverted that change in this branch - we probably need to discuss it anyway, as in BPF vs libbpf logs.

@gmarler gmarler merged commit 3b03884 into javierhonduco:main Apr 16, 2024
2 checks passed
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.

2 participants