feat: add cycle estimation flag for valgrind#412
Conversation
Merging this PR will not alter performance
|
34e3357 to
40db78c
Compare
Greptile SummaryThis PR adds a
Confidence Score: 3/5The core wiring is correct, but ArgAction::Set breaks the flag's advertised usage: passing --cycle-estimation without a value will produce a clap parse error rather than enabling the feature. The ArgAction::Set choice means the new experimental flag cannot be used in the natural way (--cycle-estimation alone) that every other bool flag in this codebase supports. A user who follows the sibling flag's example and issues --cycle-estimation will receive a hard parse error with no clear guidance. The Tracegrind/cycle-estimation combination is a narrower concern since Tracegrind is already gated as experimental, but the CLI usability defect affects all users of the new flag. src/cli/experimental.rs — the action = clap::ArgAction::Set on the new cycle_estimation field needs to be removed or changed to SetTrue before the flag is usable. Important Files Changed
|
| #[arg( | ||
| long, | ||
| default_value_t = false, | ||
| action = clap::ArgAction::Set, | ||
| help_heading = "Experimental", | ||
| env = "CODSPEED_CYCLE_ESTIMATION" | ||
| )] | ||
| pub cycle_estimation: bool, |
There was a problem hiding this comment.
ArgAction::Set with a bool type requires an explicit value on the command line — the user must pass --cycle-estimation=true rather than just --cycle-estimation. The sibling flag --experimental-fair-sched uses the implicit presence style (no action, defaults to SetTrue), so this inconsistency will surprise users. Changing to clap::ArgAction::SetTrue (or simply removing the action line) matches the existing flag's UX and lets --cycle-estimation act as a bare toggle.
| #[arg( | |
| long, | |
| default_value_t = false, | |
| action = clap::ArgAction::Set, | |
| help_heading = "Experimental", | |
| env = "CODSPEED_CYCLE_ESTIMATION" | |
| )] | |
| pub cycle_estimation: bool, | |
| #[arg( | |
| long, | |
| default_value_t = false, | |
| help_heading = "Experimental", | |
| env = "CODSPEED_CYCLE_ESTIMATION" | |
| )] | |
| pub cycle_estimation: bool, |
Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!
| if config.cycle_estimation { | ||
| args.push("--cycle-estimation=yes".to_string()); | ||
| } |
There was a problem hiding this comment.
--cycle-estimation is a Callgrind-specific option, but it is injected before the match tool block, so it will also be passed when SimulationTool::Tracegrind is selected. If Tracegrind does not recognise this option, valgrind will exit with an error for any user who combines --cycle-estimation with the Tracegrind simulation tool. Moving the push inside the SimulationTool::Callgrind arm (alongside the other Callgrind-specific args) would prevent this.
No description provided.