[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200628232521.22686-2-emmanouil.maroudas@gmail.com>
Date: Mon, 29 Jun 2020 02:25:20 +0300
From: Emmanouil Maroudas <emmanouil.maroudas@...il.com>
To: linux-kernel@...r.kernel.org
Cc: Peter Zijlstra <peterz@...radead.org>,
Ingo Molnar <mingo@...hat.com>,
Arnaldo Carvalho de Melo <acme@...nel.org>,
Mark Rutland <mark.rutland@....com>,
Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
Jiri Olsa <jolsa@...hat.com>,
Namhyung Kim <namhyung@...nel.org>,
Emmanouil Maroudas <emmanouil.maroudas@...il.com>
Subject: [PATCH 1/2] perf stat: use proper macro for time conversions
The values of interval and timeout are in msecs as documented in the
-I and --timeout options.
Use MSEC_PER_SEC instead USEC_PER_MSEC to convert to struct timespec.
Both macros have the same value 1000L (see tools/include/linux/time64.h).
No functional change intended.
Signed-off-by: Emmanouil Maroudas <emmanouil.maroudas@...il.com>
---
tools/perf/builtin-stat.c | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 9be020e0098a..6aa866e2d512 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -613,11 +613,11 @@ static int __run_perf_stat(int argc, const char **argv, int run_idx)
bool second_pass = false;
if (interval) {
- ts.tv_sec = interval / USEC_PER_MSEC;
- ts.tv_nsec = (interval % USEC_PER_MSEC) * NSEC_PER_MSEC;
+ ts.tv_sec = interval / MSEC_PER_SEC;
+ ts.tv_nsec = (interval % MSEC_PER_SEC) * NSEC_PER_MSEC;
} else if (timeout) {
- ts.tv_sec = timeout / USEC_PER_MSEC;
- ts.tv_nsec = (timeout % USEC_PER_MSEC) * NSEC_PER_MSEC;
+ ts.tv_sec = timeout / MSEC_PER_SEC;
+ ts.tv_nsec = (timeout % MSEC_PER_SEC) * NSEC_PER_MSEC;
} else {
ts.tv_sec = 1;
ts.tv_nsec = 0;
--
2.17.1
Powered by blists - more mailing lists