Skip to content

Commit a1ea71b

Browse files
authored
feat: allow quitting the tui collector manually (#12)
Signed-off-by: Wenxuan Zhang <[email protected]>
1 parent ea5ccb2 commit a1ea71b

File tree

2 files changed

+174
-139
lines changed

2 files changed

+174
-139
lines changed

src/cli.rs

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,6 +143,12 @@ pub struct BenchCli {
143143
#[clap(long, default_value = "32")]
144144
pub fps: NonZeroU8,
145145

146+
/// Quit the benchmark manually
147+
///
148+
/// Only works with the TUI collector.
149+
#[clap(long)]
150+
pub quit_manually: bool,
151+
146152
/// Output format for the report
147153
#[clap(short, long, value_enum, default_value_t = ReportFormat::Text, ignore_case = true)]
148154
pub output: ReportFormat,
@@ -203,7 +209,14 @@ where
203209
let runner = Runner::new(bench_suite, opts.clone(), res_tx, pause_rx, cancel.clone());
204210

205211
let mut collector: Box<dyn ReportCollector> = match cli.collector() {
206-
Collector::Tui => Box::new(TuiCollector::new(opts, cli.fps, res_rx, pause_tx, cancel)?),
212+
Collector::Tui => Box::new(TuiCollector::new(
213+
opts,
214+
cli.fps,
215+
res_rx,
216+
pause_tx,
217+
cancel,
218+
!cli.quit_manually,
219+
)?),
207220
Collector::Silent => Box::new(SilentCollector::new(opts, res_rx, cancel)),
208221
};
209222

0 commit comments

Comments
 (0)