mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Andrew Morton <akpm@linux-foundation.org>
Subject: [for-next][PATCH 1/9] ktest: Add timings for commands
Date: Wed, 04 Feb 2015 14:50:48 -0500	[thread overview]
Message-ID: <20150204195122.929881666@goodmis.org> (raw)
In-Reply-To: <20150204195047.818126814@goodmis.org>

[-- Attachment #1: 0001-ktest-Add-timings-for-commands.patch --]
[-- Type: text/plain, Size: 1191 bytes --]

From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>

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>
---
 tools/testing/ktest/ktest.pl | 13 +++++++++++++
 1 file changed, 13 insertions(+)

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 {
 
 sub run_command {
     my ($command, $redirect) = @_;
+    my $start_time;
+    my $end_time;
     my $dolog = 0;
     my $dord = 0;
     my $pid;
 
+    $start_time = time;
+
     $command =~ s/\$SSH_USER/$ssh_user/g;
     $command =~ s/\$MACHINE/$machine/g;
 
@@ -1570,6 +1574,15 @@ sub run_command {
     close(LOG) if ($dolog);
     close(RD)  if ($dord);
 
+    $end_time = time;
+    my $delta = $end_time - $start_time;
+
+    if ($delta == 1) {
+	doprint "[1 second] ";
+    } else {
+	doprint "[$delta seconds] ";
+    }
+
     if ($failed) {
 	doprint "FAILED!\n";
     } else {
-- 
2.1.4



  reply	other threads:[~2015-02-04 19:51 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-04 19:50 [for-next][PATCH 0/9] ktest: Updates for 3.20 Steven Rostedt
2015-02-04 19:50 ` Steven Rostedt [this message]
2015-02-04 19:50 ` [for-next][PATCH 2/9] ktest: Restore tty settings after closing console Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 3/9] ktest: Show times for build, install, boot and test Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 4/9] ktest: Rename start_monitor_and_boot to start_monitor_and_install Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 5/9] ktest: Give console process a dedicated tty Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 6/9] ktest: Enable user input to the console Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 7/9] ktest: Print build,install,boot,test times at success and failure Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 8/9] ktest: Cleanup terminal on dodie() failure Steven Rostedt
2015-02-04 19:50 ` [for-next][PATCH 9/9] ktest: Place quotes around item variable Steven Rostedt

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20150204195122.929881666@goodmis.org \
    --to=rostedt@goodmis.org \
    --cc=akpm@linux-foundation.org \
    --cc=linux-kernel@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®