lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 16 Jun 2014 11:14:20 -0700
From:	Davidlohr Bueso <davidlohr@...com>
To:	acme@...nel.org, jolsa@...nel.org
Cc:	mitake@....info.waseda.ac.jp, davidlohr@...com, aswin@...com,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/9] perf bench: sched-messaging: Redo runtime output

Instead of printing sec and usec individually, simplify
into a 'runtime' variable to later use accordingly. This
is particularly helpful when later adding multiple runs
and collecting statistics.

Signed-off-by: Davidlohr Bueso <davidlohr@...com>
---
 tools/perf/bench/sched-messaging.c | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/tools/perf/bench/sched-messaging.c b/tools/perf/bench/sched-messaging.c
index cc1190a..df0828a 100644
--- a/tools/perf/bench/sched-messaging.c
+++ b/tools/perf/bench/sched-messaging.c
@@ -269,9 +269,9 @@ static const char * const bench_sched_message_usage[] = {
 int bench_sched_messaging(int argc, const char **argv,
 		    const char *prefix __maybe_unused)
 {
-	unsigned int i, total_children;
+	unsigned int i, total_children, num_fds = 20;
 	struct timeval start, stop, diff;
-	unsigned int num_fds = 20;
+	unsigned long runtime;
 	int readyfds[2], wakefds[2];
 	char dummy;
 	pthread_t *pth_tab;
@@ -307,8 +307,8 @@ int bench_sched_messaging(int argc, const char **argv,
 		reap_worker(pth_tab[i]);
 
 	gettimeofday(&stop, NULL);
-
 	timersub(&stop, &start, &diff);
+	runtime = (diff.tv_sec * 1e3) + (diff.tv_usec/1e3);
 
 	switch (bench_format) {
 	case BENCH_FORMAT_DEFAULT:
@@ -317,13 +317,10 @@ int bench_sched_messaging(int argc, const char **argv,
 		printf("# %d groups == %d %s run\n\n",
 		       num_groups, num_groups * 2 * num_fds,
 		       thread_mode ? "threads" : "processes");
-		printf(" %14s: %lu.%03lu [sec]\n", "Total time",
-		       diff.tv_sec,
-		       (unsigned long) (diff.tv_usec/1000));
+		printf(" %14s: %.3f [sec]\n", "Total time", runtime/1e3);
 		break;
 	case BENCH_FORMAT_SIMPLE:
-		printf("%lu.%03lu\n", diff.tv_sec,
-		       (unsigned long) (diff.tv_usec/1000));
+		printf("%.3f\n", runtime/1e3);
 		break;
 	default:
 		/* reaching here is something disaster */
-- 
1.8.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ