Skip to content

Commit

Permalink
feat: allow quitting the tui collector manually (#12)
Browse files Browse the repository at this point in the history
Signed-off-by: Wenxuan Zhang <wenxuangm@gmail.com>
  • Loading branch information
wfxr authored Apr 24, 2024
1 parent ea5ccb2 commit a1ea71b
Show file tree
Hide file tree
Showing 2 changed files with 174 additions and 139 deletions.
15 changes: 14 additions & 1 deletion src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,12 @@ pub struct BenchCli {
#[clap(long, default_value = "32")]
pub fps: NonZeroU8,

/// Quit the benchmark manually
///
/// Only works with the TUI collector.
#[clap(long)]
pub quit_manually: bool,

/// Output format for the report
#[clap(short, long, value_enum, default_value_t = ReportFormat::Text, ignore_case = true)]
pub output: ReportFormat,
Expand Down Expand Up @@ -203,7 +209,14 @@ where
let runner = Runner::new(bench_suite, opts.clone(), res_tx, pause_rx, cancel.clone());

let mut collector: Box<dyn ReportCollector> = match cli.collector() {
Collector::Tui => Box::new(TuiCollector::new(opts, cli.fps, res_rx, pause_tx, cancel)?),
Collector::Tui => Box::new(TuiCollector::new(
opts,
cli.fps,
res_rx,
pause_tx,
cancel,
!cli.quit_manually,
)?),
Collector::Silent => Box::new(SilentCollector::new(opts, res_rx, cancel)),
};

Expand Down
Loading

0 comments on commit a1ea71b

Please sign in to comment.