Skip to content
This repository was archived by the owner on Jun 27, 2018. It is now read-only.

Commit 20fe3f1

Browse files
committed
Time commands
1 parent 11ef745 commit 20fe3f1

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/docker.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ use std::mem;
44
use std::process::{Output, Command, Stdio, ExitStatus};
55
use std::sync::{Arc, Mutex};
66
use std::thread;
7-
use std::time::Duration;
7+
use std::time::{Duration, Instant};
88

99
use wait_timeout::ChildExt;
1010

@@ -46,6 +46,7 @@ impl Container {
4646
.stdout(Stdio::piped())
4747
.stderr(Stdio::piped());
4848
debug!("attaching with {:?}", cmd);
49+
let start = Instant::now();
4950
let mut cmd = try!(cmd.spawn());
5051
try!(cmd.stdin.take().unwrap().write_all(input));
5152
debug!("input written, now waiting");
@@ -72,6 +73,7 @@ impl Container {
7273
};
7374
stdout.join().unwrap();
7475
stderr.join().unwrap();
76+
debug!("timing: {:?}", start.elapsed());
7577
let mut lock = sink.lock().unwrap();
7678
let output = mem::replace(&mut *lock, Vec::new());
7779
debug!("status: {}", status);
@@ -101,7 +103,9 @@ impl Drop for Container {
101103

102104
fn run(cmd: &mut Command) -> io::Result<Output> {
103105
debug!("spawning: {:?}", cmd);
106+
let start = Instant::now();
104107
let out = try!(cmd.output());
108+
debug!("done in: {:?}", start.elapsed());
105109
debug!("output: {:?}", out);
106110
if !out.status.success() {
107111
let msg = format!("process failed: {:?}\n{:?}", cmd, out);

0 commit comments

Comments
 (0)