All of lore.kernel.org
 help / color / mirror / Atom feed
From: "tip-bot for Chaos.Chen" <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: rainboy1215@gmail.com, akpm@linux-foundation.org,
	rostedt@goodmis.org, tglx@linutronix.de,
	linux-kernel@vger.kernel.org, mingo@kernel.org, acme@redhat.com,
	hpa@zytor.com
Subject: [tip:perf/core] tools lib traceevent: Fix time stamp rounding issue
Date: Sat, 5 Mar 2016 00:19:06 -0800	[thread overview]
Message-ID: <tip-21a30100453516004905d4d5f0806ebaffa95131@git.kernel.org> (raw)
In-Reply-To: <20160209204236.824426460@goodmis.org>

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;
 		}
 

  reply	other threads:[~2016-03-05  8:19 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-09 20:40 [PATCH 0/4] tools lib traceevent: Updates from trace-cmd Steven Rostedt
2016-02-09 20:40 ` [PATCH 1/4] tools lib traceevent: Fix time stamp rounding issue Steven Rostedt
2016-03-05  8:19   ` tip-bot for Chaos.Chen [this message]
2016-02-09 20:40 ` [PATCH 2/4] tools lib traceevent: Use USECS_PER_SEC instead of hardcoded number Steven Rostedt
2016-03-02 12:20   ` Arnaldo Carvalho de Melo
2016-08-05 18:19     ` Steven Rostedt
2016-08-05 18:36       ` Arnaldo Carvalho de Melo
2016-08-05 19:15         ` Steven Rostedt
2016-08-05 23:02           ` Arnaldo Carvalho de Melo
2016-02-09 20:40 ` [PATCH 3/4] tools lib traceevent: Set int_array fields to NULL if freeing from error Steven Rostedt
2016-03-05  8:19   ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2016-02-09 20:40 ` [PATCH 4/4] tools lib traceevent: Fix output of %llu for 64 bit values read on 32 bit machines Steven Rostedt
2016-03-05  8:19   ` [tip:perf/core] " tip-bot for Steven Rostedt (Red Hat)
2016-03-01 21:47 ` [PATCH 0/4] tools lib traceevent: Updates from trace-cmd 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=tip-21a30100453516004905d4d5f0806ebaffa95131@git.kernel.org \
    --to=tipbot@zytor.com \
    --cc=acme@redhat.com \
    --cc=akpm@linux-foundation.org \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-tip-commits@vger.kernel.org \
    --cc=mingo@kernel.org \
    --cc=rainboy1215@gmail.com \
    --cc=rostedt@goodmis.org \
    --cc=tglx@linutronix.de \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.