Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1350836 > unrolled thread
| Started by | "tip-bot for Chaos.Chen" <tipbot@zytor.com> |
|---|---|
| First post | 2016-03-05 09:20 +0100 |
| Last post | 2016-03-05 09:20 +0100 |
| Articles | 1 — 1 participant |
Back to article view | Back to linux.kernel
This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by
below is the oldest one visible, not the original post.
[tip:perf/core] tools lib traceevent: Fix time stamp rounding issue "tip-bot for Chaos.Chen" <tipbot@zytor.com> - 2016-03-05 09:20 +0100
| From | "tip-bot for Chaos.Chen" <tipbot@zytor.com> |
|---|---|
| Date | 2016-03-05 09:20 +0100 |
| Subject | [tip:perf/core] tools lib traceevent: Fix time stamp rounding issue |
| Message-ID | <r9fBp-3k0-29@gated-at.bofh.it> |
Commit-ID: 21a30100453516004905d4d5f0806ebaffa95131
Gitweb: http://git.kernel.org/tip/21a30100453516004905d4d5f0806ebaffa95131
Author: Chaos.Chen <rainboy1215@gmail.com>
AuthorDate: Tue, 9 Feb 2016 15:40:14 -0500
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Thu, 3 Mar 2016 11:10:37 -0300
tools lib traceevent: Fix time stamp rounding issue
When rounding to microseconds, if the timestamp subsecond is between
.999999500 and .999999999, it is rounded to .1000000, when it should
instead increment the second counter due to the overflow.
For example, if the timestamp is 1234.999999501 instead of seeing:
1235.000000
we see:
1234.1000000
Signed-off-by: Chaos.Chen <rainboy1215@gmail.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Link: http://lkml.kernel.org/r/20160209204236.824426460@goodmis.org
[ fixed incrementing "secs" instead of decrementing it ]
Signed-off-by: Steven Rostedt <rostedt@goodmis.org>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/lib/traceevent/event-parse.c | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/tools/lib/traceevent/event-parse.c b/tools/lib/traceevent/event-parse.c
index 9a1e48a..ce59f48 100644
--- a/tools/lib/traceevent/event-parse.c
+++ b/tools/lib/traceevent/event-parse.c
@@ -5429,6 +5429,11 @@ void pevent_print_event_time(struct pevent *pevent, struct trace_seq *s,
p = 9;
} else {
usecs = (nsecs + 500) / NSECS_PER_USEC;
+ /* To avoid usecs larger than 1 sec */
+ if (usecs >= 1000000) {
+ usecs -= 1000000;
+ secs++;
+ }
p = 6;
}
Back to top | Article view | linux.kernel
csiph-web