From: Emmanouil Maroudas <emmanouil.maroudas@gmail.com>
To: linux-kernel@vger.kernel.org
Cc: Peter Zijlstra <peterz@infradead.org>,
Ingo Molnar <mingo@redhat.com>,
Arnaldo Carvalho de Melo <acme@kernel.org>,
Mark Rutland <mark.rutland@arm.com>,
Alexander Shishkin <alexander.shishkin@linux.intel.com>,
Jiri Olsa <jolsa@redhat.com>, Namhyung Kim <namhyung@kernel.org>,
Emmanouil Maroudas <emmanouil.maroudas@gmail.com>
Subject: [PATCH 1/2] perf stat: use proper macro for time conversions
Date: Mon, 29 Jun 2020 02:25:20 +0300 [thread overview]
Message-ID: <20200628232521.22686-2-emmanouil.maroudas@gmail.com> (raw)
In-Reply-To: <20200628232521.22686-1-emmanouil.maroudas@gmail.com>
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@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
next prev parent reply other threads:[~2020-06-28 23:25 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-06-28 23:25 [PATCH 0/2] perf tools: minor fixes regarding macro usage Emmanouil Maroudas
2020-06-28 23:25 ` Emmanouil Maroudas [this message]
2020-06-28 23:25 ` [PATCH 2/2] perf tools: use *SEC_PER_*SEC macros Emmanouil Maroudas
2020-07-03 10:55 ` [PATCH 0/2] perf tools: minor fixes regarding macro usage Jiri Olsa
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200628232521.22686-2-emmanouil.maroudas@gmail.com \
--to=emmanouil.maroudas@gmail.com \
--cc=acme@kernel.org \
--cc=alexander.shishkin@linux.intel.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mark.rutland@arm.com \
--cc=mingo@redhat.com \
--cc=namhyung@kernel.org \
--cc=peterz@infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®