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.marou...@gmail.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

Reply via email to