javierhonduco / lightswitch

CPU profiler for Linux written in Rust
MIT License
7 stars 3 forks source link

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

Closed gmarler closed 7 months ago

gmarler commented 7 months ago

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 commented 7 months ago

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?

gmarler commented 7 months ago

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.