perf bench sched-pipe: Use linux/time64.h, USEC_PER_SEC

Following kernel practices.

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-wgfu1h1pnw8lc919o2tan58y@git.kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent af4b2c97
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include <sys/time.h> #include <sys/time.h>
#include <sys/types.h> #include <sys/types.h>
#include <sys/syscall.h> #include <sys/syscall.h>
#include <linux/time64.h>
#include <pthread.h> #include <pthread.h>
...@@ -153,24 +154,24 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu ...@@ -153,24 +154,24 @@ int bench_sched_pipe(int argc, const char **argv, const char *prefix __maybe_unu
printf("# Executed %d pipe operations between two %s\n\n", printf("# Executed %d pipe operations between two %s\n\n",
loops, threaded ? "threads" : "processes"); loops, threaded ? "threads" : "processes");
result_usec = diff.tv_sec * 1000000; result_usec = diff.tv_sec * USEC_PER_SEC;
result_usec += diff.tv_usec; result_usec += diff.tv_usec;
printf(" %14s: %lu.%03lu [sec]\n\n", "Total time", printf(" %14s: %lu.%03lu [sec]\n\n", "Total time",
diff.tv_sec, diff.tv_sec,
(unsigned long) (diff.tv_usec/1000)); (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
printf(" %14lf usecs/op\n", printf(" %14lf usecs/op\n",
(double)result_usec / (double)loops); (double)result_usec / (double)loops);
printf(" %14d ops/sec\n", printf(" %14d ops/sec\n",
(int)((double)loops / (int)((double)loops /
((double)result_usec / (double)1000000))); ((double)result_usec / (double)USEC_PER_SEC)));
break; break;
case BENCH_FORMAT_SIMPLE: case BENCH_FORMAT_SIMPLE:
printf("%lu.%03lu\n", printf("%lu.%03lu\n",
diff.tv_sec, diff.tv_sec,
(unsigned long) (diff.tv_usec / 1000)); (unsigned long) (diff.tv_usec / USEC_PER_MSEC));
break; break;
default: default:
......
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