From: Steven Rostedt <rostedt@goodmis.org>
To: linux-kernel@vger.kernel.org
Cc: Arnaldo Carvalho de Melo <acme@kernel.org>,
Ingo Molnar <mingo@kernel.org>, Jiri Olsa <jolsa@redhat.com>,
Namhyung Kim <namhyung@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>
Subject: [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number
Date: Fri, 18 Nov 2016 17:54:01 -0500 [thread overview]
Message-ID: <20161118225457.987025355@goodmis.org> (raw)
In-Reply-To: 20161118225359.378120451@goodmis.org
[-- Attachment #1: 0002-tools-lib-traceevent-Use-USECS_PER_SEC-instead-of-ha.patch --]
[-- Type: text/plain, Size: 1389 bytes --]
From: "Steven Rostedt (Red Hat)" <rostedt@goodmis.org>
Instead of using 1000000, define a USECS_PER_SEC macro and use that instead.
Link: http://lkml.kernel.org/r/20160209204237.006667394@goodmis.org
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
---
tools/lib/traceevent/event-parse.c | 4 ++--
tools/lib/traceevent/event-parse.h | 2 ++
2 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index d6f3cc0a29b0..2b85b339f6b9 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5465,8 +5465,8 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s,
} else {
usecs = (nsecs + 500) / NSECS_PER_USEC;
/* To avoid usecs larger than 1 sec */
- if (usecs >= 1000000) {
- usecs -= 1000000;
+ if (usecs >= USECS_PER_SEC) {
+ usecs -= USECS_PER_SEC;
secs++;
}
p = 6;
diff --git a/tools/lib/traceevent/event-parse.h b/tools/lib/traceevent/event-parse.h
index 41b3d2238ed3..b09dd49465b0 100644
--- a/tools/lib/traceevent/event-parse.h
+++ b/tools/lib/traceevent/event-parse.h
@@ -175,6 +175,8 @@ struct pevent_plugin_option {
#define NSECS_PER_SEC 1000000000ULL
#define NSECS_PER_USEC 1000ULL
+#define USECS_PER_SEC 1000000ULL
+
enum format_flags {
FIELD_IS_ARRAY = 1,
FIELD_IS_POINTER = 2,
--
2.10.2
next prev parent reply other threads:[~2016-11-18 22:55 UTC|newest]
Thread overview: 14+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-18 22:53 [PATCH 0/2] tools lib traceevent: A couple of updates Steven Rostedt
2016-11-18 22:54 ` [PATCH 1/2] tools lib traceevent: Add retrieval of preempt count and latency flags Steven Rostedt
2016-11-22 6:52 ` Namhyung Kim
2016-11-22 14:33 ` Steven Rostedt
2016-11-22 16:31 ` [PATCH v2] " Steven Rostedt
2016-11-22 18:06 ` Arnaldo Carvalho de Melo
2016-11-23 4:45 ` Namhyung Kim
2016-11-24 4:15 ` [tip:perf/core] " tip-bot for Steven Rostedt
2016-11-18 22:54 ` Steven Rostedt [this message]
2016-11-18 23:40 ` [PATCH 2/2] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Arnaldo Carvalho de Melo
2016-11-21 16:41 ` Steven Rostedt
2016-11-21 19:11 ` Arnaldo Carvalho de Melo
2016-11-22 6:53 ` Namhyung Kim
2016-11-24 4:14 ` [tip:perf/core] " tip-bot for Steven Rostedt
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=20161118225457.987025355@goodmis.org \
--to=rostedt@goodmis.org \
--cc=acme@kernel.org \
--cc=akpm@linux-foundation.org \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=namhyung@kernel.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;
as well as URLs for NNTP newsgroup(s).