mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
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 2/2] perf tools: use *SEC_PER_*SEC macros
Date: Mon, 29 Jun 2020 02:25:21 +0300	[thread overview]
Message-ID: <20200628232521.22686-3-emmanouil.maroudas@gmail.com> (raw)
In-Reply-To: <20200628232521.22686-1-emmanouil.maroudas@gmail.com>

    builtin-stat.c: typecast macro to u64
    see commit ea9eb1f456a0 ("perf stat: Fix duration_time value for higher intervals")

    No functional change intended.

Signed-off-by: Emmanouil Maroudas <emmanouil.maroudas@gmail.com>
---
 tools/perf/builtin-record.c | 2 +-
 tools/perf/builtin-stat.c   | 4 ++--
 tools/perf/builtin-trace.c  | 2 +-
 3 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index e108d90ae2ed..c3c7823966bc 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -249,7 +249,7 @@ static int record__aio_sync(struct mmap *md, bool sync_all)
 {
 	struct aiocb **aiocb = md->aio.aiocb;
 	struct aiocb *cblocks = md->aio.cblocks;
-	struct timespec timeout = { 0, 1000 * 1000  * 1 }; /* 1ms */
+	struct timespec timeout = { 0, NSEC_PER_MSEC * 1 }; /* 1ms */
 	int i, do_suspend;
 
 	do {
diff --git a/tools/perf/builtin-stat.c b/tools/perf/builtin-stat.c
index 6aa866e2d512..2f4fe1aee865 100644
--- a/tools/perf/builtin-stat.c
+++ b/tools/perf/builtin-stat.c
@@ -305,7 +305,7 @@ static int read_single_counter(struct evsel *counter, int cpu,
 			       int thread, struct timespec *rs)
 {
 	if (counter->tool_event == PERF_TOOL_DURATION_TIME) {
-		u64 val = rs->tv_nsec + rs->tv_sec*1000000000ULL;
+		u64 val = rs->tv_nsec + rs->tv_sec*(u64)NSEC_PER_SEC;
 		struct perf_counts_values *count =
 			perf_counts(counter->counts, cpu, thread);
 		count->ena = count->run = val;
@@ -471,7 +471,7 @@ static void process_interval(void)
 	}
 
 	init_stats(&walltime_nsecs_stats);
-	update_stats(&walltime_nsecs_stats, stat_config.interval * 1000000ULL);
+	update_stats(&walltime_nsecs_stats, stat_config.interval * (u64)NSEC_PER_MSEC);
 	print_counters(&rs, 0, NULL);
 }
 
diff --git a/tools/perf/builtin-trace.c b/tools/perf/builtin-trace.c
index 4cbb64edc998..db0a2369e2f2 100644
--- a/tools/perf/builtin-trace.c
+++ b/tools/perf/builtin-trace.c
@@ -4043,7 +4043,7 @@ static int trace__run(struct trace *trace, int argc, const char **argv)
 		perf_evlist__start_workload(evlist);
 
 	if (trace->opts.initial_delay) {
-		usleep(trace->opts.initial_delay * 1000);
+		usleep(trace->opts.initial_delay * USEC_PER_MSEC);
 		evlist__enable(evlist);
 	}
 
-- 
2.17.1


  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 ` [PATCH 1/2] perf stat: use proper macro for time conversions Emmanouil Maroudas
2020-06-28 23:25 ` Emmanouil Maroudas [this message]
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-3-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®