Linux Test Project
 help / color / mirror / Atom feed
From: Dylan Jhong <dylan@andestech.com>
To: <ltp@lists.linux.it>
Cc: alankao@andestech.com, dminus@andestech.com,
	randolph@andestech.com, x5710999x@gmail.com
Subject: [LTP] [PATCH] pan/ltp-pan.c: Add execution time field in results/logs
Date: Tue, 9 Aug 2022 16:27:01 +0800	[thread overview]
Message-ID: <20220809082701.2366582-1-dylan@andestech.com> (raw)

The current log only shows the success or failure of testcases, but
execution time is also one of the important indicators to observe LTP
testcases.

In this patch, we modified the format of the logs in results/ and added
a column to record the execution time.

Signed-off-by: Dylan Jhong <dylan@andestech.com>
---
 pan/ltp-pan.c | 24 +++++++++++++++---------
 1 file changed, 15 insertions(+), 9 deletions(-)

diff --git a/pan/ltp-pan.c b/pan/ltp-pan.c
index 0bdb51477..1bb255b4a 100644
--- a/pan/ltp-pan.c
+++ b/pan/ltp-pan.c
@@ -132,7 +132,11 @@ zoo_t zoofile;
 static char *reporttype = NULL;
 
 /* Common format string for ltp-pan results */
-#define ResultFmt	"%-50s %-10.10s"
+#define ResultFmt           "%-50s %-10.10s"
+#define ExitValTitleFmt     "%-12.12s"
+#define ExitValFmt          "%-12d"
+#define ExecTimeTitleFmt    "%-20.20s"
+#define ExecTimeFmt         "%-20d"
 
 /* zoolib */
 int rec_signal;			/* received signal */
@@ -354,10 +358,10 @@ int main(int argc, char **argv)
 			fprintf(logfile, "Test Start Time: %s\n", s);
 			fprintf(logfile,
 				"-----------------------------------------\n");
-			fprintf(logfile, ResultFmt" %-10.10s\n",
-				"Testcase", "Result", "Exit Value");
-			fprintf(logfile, ResultFmt" %-10.10s\n",
-				"--------", "------", "------------");
+			fprintf(logfile, ResultFmt" "ExitValTitleFmt" "ExecTimeTitleFmt"\n",
+				"Testcase", "Result", "Exit Value", "Execution Time(sec)");
+			fprintf(logfile, ResultFmt" "ExitValTitleFmt" "ExecTimeTitleFmt"\n",
+				"--------", "------", "----------", "-------------------");
 		}
 		fflush(logfile);
 	}
@@ -829,10 +833,11 @@ check_pids(struct tag_pgrp *running, int *num_active, int keep_active,
 						}
 
 						fprintf(logfile,
-							ResultFmt" %-5d\n",
+							ResultFmt" "ExitValFmt" "ExecTimeFmt"\n",
 							running[i].cmd->name,
 							result_str,
-							w);
+							w,
+							(int)(t - running[i].mystime));
 					}
 
 					fflush(logfile);
@@ -1108,10 +1113,11 @@ run_child(struct coll_entry *colle, struct tag_pgrp *active, int quiet_mode,
 				if (termid != 0)
 					++ * failcnt;
 
-				fprintf(logfile, ResultFmt" %-5d\n",
+				fprintf(logfile, ResultFmt" "ExitValFmt" "ExecTimeFmt"\n",
 					colle->name,
 					((termid != 0) ? "FAIL" : "PASS"),
-					termid);
+					termid,
+					(int)(end_time - active->mystime));
 			}
 			fflush(logfile);
 		}
-- 
2.34.1


-- 
Mailing list info: https://lists.linux.it/listinfo/ltp

             reply	other threads:[~2022-08-09  8:33 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-08-09  8:27 Dylan Jhong [this message]
2022-08-11 11:41 ` [LTP] [PATCH] pan/ltp-pan.c: Add execution time field in results/logs Cyril Hrubis

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=20220809082701.2366582-1-dylan@andestech.com \
    --to=dylan@andestech.com \
    --cc=alankao@andestech.com \
    --cc=dminus@andestech.com \
    --cc=ltp@lists.linux.it \
    --cc=randolph@andestech.com \
    --cc=x5710999x@gmail.com \
    /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