summaryrefslogtreecommitdiff
path: root/src/bin/obnam.rs
diff options
context:
space:
mode:
authorLars Wirzenius <liw@liw.fi>2022-04-06 05:33:25 +0000
committerLars Wirzenius <liw@liw.fi>2022-04-06 05:33:25 +0000
commit1c6ae813b00e46d2a8061fa480d1780124af1e64 (patch)
treec7d274adb6e0021c143436ac13eac934d5fe1c1e /src/bin/obnam.rs
parent961d091f418f67c7435d085a4d71cc17b78345a9 (diff)
parentdd13fde5ea8bd61b6b5c7f024df6733301864456 (diff)
downloadobnam2-1c6ae813b00e46d2a8061fa480d1780124af1e64.tar.gz
Merge branch 'perf-stats-3' into 'main'
Log some performance measurements Closes #174 See merge request obnam/obnam!226
Diffstat (limited to 'src/bin/obnam.rs')
-rw-r--r--src/bin/obnam.rs11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/bin/obnam.rs b/src/bin/obnam.rs
index 15c7d06..089a7a1 100644
--- a/src/bin/obnam.rs
+++ b/src/bin/obnam.rs
@@ -17,6 +17,7 @@ use obnam::cmd::restore::Restore;
use obnam::cmd::show_config::ShowConfig;
use obnam::cmd::show_gen::ShowGeneration;
use obnam::config::ClientConfig;
+use obnam::performance::{Clock, Performance};
use std::path::{Path, PathBuf};
use structopt::StructOpt;
@@ -25,14 +26,18 @@ const ORG: &str = "";
const APPLICATION: &str = "obnam";
fn main() {
- if let Err(err) = main_program() {
+ let mut perf = Performance::default();
+ perf.start(Clock::RunTime);
+ if let Err(err) = main_program(&mut perf) {
error!("{}", err);
eprintln!("ERROR: {}", err);
std::process::exit(1);
}
+ perf.stop(Clock::RunTime);
+ perf.log();
}
-fn main_program() -> anyhow::Result<()> {
+fn main_program(perf: &mut Performance) -> anyhow::Result<()> {
let opt = Opt::from_args();
let config = ClientConfig::read(&config_filename(&opt))?;
setup_logging(&config.log)?;
@@ -44,7 +49,7 @@ fn main_program() -> anyhow::Result<()> {
match opt.cmd {
Command::Init(x) => x.run(&config),
Command::ListBackupVersions(x) => x.run(&config),
- Command::Backup(x) => x.run(&config),
+ Command::Backup(x) => x.run(&config, perf),
Command::Inspect(x) => x.run(&config),
Command::Chunkify(x) => x.run(&config),
Command::List(x) => x.run(&config),