Skip to content

Commit

Permalink
add build time to buildfinished summary
Browse files Browse the repository at this point in the history
  • Loading branch information
csmoe committed Sep 14, 2020
1 parent 6015133 commit 8132e2a
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/cargo/core/compiler/job_queue.rs
Expand Up @@ -696,7 +696,8 @@ impl<'cfg> DrainState<'cfg> {
opt_type += " + debuginfo";
}

let time_elapsed = util::elapsed(cx.bcx.config.creation_time().elapsed());
let build_duration = cx.bcx.config.creation_time().elapsed();
let time_elapsed = util::elapsed(build_duration);
if let Err(e) = self.timings.finished(cx.bcx, &error) {
if error.is_some() {
crate::display_error(&e, &mut cx.bcx.config.shell());
Expand All @@ -707,6 +708,7 @@ impl<'cfg> DrainState<'cfg> {
if cx.bcx.build_config.emit_json() {
let msg = machine_message::BuildFinished {
success: error.is_none(),
duration: build_duration.as_secs_f64(),
}
.to_json_string();
if let Err(e) = writeln!(cx.bcx.config.shell().out(), "{}", msg) {
Expand Down
1 change: 1 addition & 0 deletions src/cargo/util/machine_message.rs
Expand Up @@ -94,6 +94,7 @@ impl<'a> Message for TimingInfo<'a> {
#[derive(Serialize)]
pub struct BuildFinished {
pub success: bool,
pub duration: f64,
}

impl Message for BuildFinished {
Expand Down

0 comments on commit 8132e2a

Please sign in to comment.