aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorSteven Rostedt (Red Hat) <rostedt@goodmis.org>2015-01-27 17:02:02 -0500
committerSteven Rostedt <rostedt@goodmis.org>2015-01-27 17:44:56 -0500
commitb53486e08377506179e5da0abe8b960dba5c483a (patch)
tree07d082934ee784beca73c21c20d4e53c2286cd30 /tools
parent97bf6af1f928216fd6c5a66e8a57bfa95a659672 (diff)
ktest: Add timings for commands
I find that I usually like to see how long a make or other command takes, and adding a start and end time and reporting how long each command runs (in seconds) is helpful. Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/testing/ktest/ktest.pl13
1 files changed, 13 insertions, 0 deletions
diff --git a/tools/testing/ktest/ktest.pl b/tools/testing/ktest/ktest.pl
index b9cd036f0442..27273c228d92 100755
--- a/tools/testing/ktest/ktest.pl
+++ b/tools/testing/ktest/ktest.pl
@@ -1534,10 +1534,14 @@ sub fail {
1534 1534
1535sub run_command { 1535sub run_command {
1536 my ($command, $redirect) = @_; 1536 my ($command, $redirect) = @_;
1537 my $start_time;
1538 my $end_time;
1537 my $dolog = 0; 1539 my $dolog = 0;
1538 my $dord = 0; 1540 my $dord = 0;
1539 my $pid; 1541 my $pid;
1540 1542
1543 $start_time = time;
1544
1541 $command =~ s/\$SSH_USER/$ssh_user/g; 1545 $command =~ s/\$SSH_USER/$ssh_user/g;
1542 $command =~ s/\$MACHINE/$machine/g; 1546 $command =~ s/\$MACHINE/$machine/g;
1543 1547
@@ -1570,6 +1574,15 @@ sub run_command {
1570 close(LOG) if ($dolog); 1574 close(LOG) if ($dolog);
1571 close(RD) if ($dord); 1575 close(RD) if ($dord);
1572 1576
1577 $end_time = time;
1578 my $delta = $end_time - $start_time;
1579
1580 if ($delta == 1) {
1581 doprint "[1 second] ";
1582 } else {
1583 doprint "[$delta seconds] ";
1584 }
1585
1573 if ($failed) { 1586 if ($failed) {
1574 doprint "FAILED!\n"; 1587 doprint "FAILED!\n";
1575 } else { 1588 } else {