perf bench futex: Use NSEC_PER_USEC

Following kernel practices and better documentin

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@kernel.org>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Steven Rostedt <rostedt@goodmis.org>
Cc: Wang Nan <wangnan0@huawei.com>
Link: http://lkml.kernel.org/n/tip-xncwqxegjp13g2nxih3lp9mx@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent c05a6e14
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/time64.h>
#include <errno.h> #include <errno.h>
#include "bench.h" #include "bench.h"
#include "futex.h" #include "futex.h"
...@@ -62,7 +63,7 @@ static void print_summary(void) ...@@ -62,7 +63,7 @@ static void print_summary(void)
printf("Requeued %d of %d threads in %.4f ms (+-%.2f%%)\n", printf("Requeued %d of %d threads in %.4f ms (+-%.2f%%)\n",
requeued_avg, requeued_avg,
nthreads, nthreads,
requeuetime_avg/1e3, requeuetime_avg / USEC_PER_MSEC,
rel_stddev_stats(requeuetime_stddev, requeuetime_avg)); rel_stddev_stats(requeuetime_stddev, requeuetime_avg));
} }
...@@ -184,7 +185,7 @@ int bench_futex_requeue(int argc, const char **argv, ...@@ -184,7 +185,7 @@ int bench_futex_requeue(int argc, const char **argv,
if (!silent) { if (!silent) {
printf("[Run %d]: Requeued %d of %d threads in %.4f ms\n", printf("[Run %d]: Requeued %d of %d threads in %.4f ms\n",
j + 1, nrequeued, nthreads, runtime.tv_usec/1e3); j + 1, nrequeued, nthreads, runtime.tv_usec / (double)USEC_PER_MSEC);
} }
/* everybody should be blocked on futex2, wake'em up */ /* everybody should be blocked on futex2, wake'em up */
......
...@@ -15,6 +15,7 @@ ...@@ -15,6 +15,7 @@
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/time64.h>
#include <errno.h> #include <errno.h>
#include "bench.h" #include "bench.h"
#include "futex.h" #include "futex.h"
...@@ -156,7 +157,7 @@ static void print_run(struct thread_data *waking_worker, unsigned int run_num) ...@@ -156,7 +157,7 @@ static void print_run(struct thread_data *waking_worker, unsigned int run_num)
printf("[Run %d]: Avg per-thread latency (waking %d/%d threads) " printf("[Run %d]: Avg per-thread latency (waking %d/%d threads) "
"in %.4f ms (+-%.2f%%)\n", run_num + 1, wakeup_avg, "in %.4f ms (+-%.2f%%)\n", run_num + 1, wakeup_avg,
nblocked_threads, waketime_avg/1e3, nblocked_threads, waketime_avg / USEC_PER_MSEC,
rel_stddev_stats(waketime_stddev, waketime_avg)); rel_stddev_stats(waketime_stddev, waketime_avg));
} }
...@@ -172,7 +173,7 @@ static void print_summary(void) ...@@ -172,7 +173,7 @@ static void print_summary(void)
printf("Avg per-thread latency (waking %d/%d threads) in %.4f ms (+-%.2f%%)\n", printf("Avg per-thread latency (waking %d/%d threads) in %.4f ms (+-%.2f%%)\n",
wakeup_avg, wakeup_avg,
nblocked_threads, nblocked_threads,
waketime_avg/1e3, waketime_avg / USEC_PER_MSEC,
rel_stddev_stats(waketime_stddev, waketime_avg)); rel_stddev_stats(waketime_stddev, waketime_avg));
} }
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#include <subcmd/parse-options.h> #include <subcmd/parse-options.h>
#include <linux/compiler.h> #include <linux/compiler.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/time64.h>
#include <errno.h> #include <errno.h>
#include "bench.h" #include "bench.h"
#include "futex.h" #include "futex.h"
...@@ -81,7 +82,7 @@ static void print_summary(void) ...@@ -81,7 +82,7 @@ static void print_summary(void)
printf("Wokeup %d of %d threads in %.4f ms (+-%.2f%%)\n", printf("Wokeup %d of %d threads in %.4f ms (+-%.2f%%)\n",
wakeup_avg, wakeup_avg,
nthreads, nthreads,
waketime_avg/1e3, waketime_avg / USEC_PER_MSEC,
rel_stddev_stats(waketime_stddev, waketime_avg)); rel_stddev_stats(waketime_stddev, waketime_avg));
} }
...@@ -182,7 +183,7 @@ int bench_futex_wake(int argc, const char **argv, ...@@ -182,7 +183,7 @@ int bench_futex_wake(int argc, const char **argv,
if (!silent) { if (!silent) {
printf("[Run %d]: Wokeup %d of %d threads in %.4f ms\n", printf("[Run %d]: Wokeup %d of %d threads in %.4f ms\n",
j + 1, nwoken, nthreads, runtime.tv_usec/1e3); j + 1, nwoken, nthreads, runtime.tv_usec / (double)USEC_PER_MSEC);
} }
for (i = 0; i < nthreads; i++) { for (i = 0; i < nthreads; i++) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment