Skip to content

Commit

Permalink
Add line breaker to below dump
Browse files Browse the repository at this point in the history
Summary:
* Disabled newline in dump by default between samples.
* Add command line option `br` as line breaker.

Reviewed By: dschatzberg

Differential Revision: D23878431

fbshipit-source-id: f159b0d5b4832f06c1daf58a84c77ef9fb17fcad
  • Loading branch information
boyuni authored and facebook-github-bot committed Sep 25, 2020
1 parent c85c71d commit 688f192
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
3 changes: 3 additions & 0 deletions resctl/below/dump/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,9 @@ pub struct GeneralOpt {
/// Days adjuster, same as -r option in replay.
#[structopt(short = "r")]
pub yesterdays: Option<String>,
/// Line break symbol between samples
#[structopt(long)]
pub br: Option<String>,
}

#[derive(Debug, StructOpt, Clone)]
Expand Down
5 changes: 4 additions & 1 deletion resctl/below/dump/src/tmain.rs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,7 @@ where

let json = self.get_opts().output_format == Some(OutputFormat::Json);
let csv = self.get_opts().output_format == Some(OutputFormat::Csv);
let br = self.get_opts().br.clone();

let mut round = 0;

Expand Down Expand Up @@ -169,8 +170,10 @@ where
continue;
}

if !csv {
if json {
write!(output, "\n")?;
} else if br.is_some() && !csv {
write!(output, "{}\n", br.as_ref().unwrap())?;
}
}

Expand Down

0 comments on commit 688f192

Please sign in to comment.