From: Mathieu Desnoyers <compudj@krystal.dyndns.org>
To: Steven Rostedt <rostedt@goodmis.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@elte.hu>,
Thomas Gleixner <tglx@linutronix.de>,
Peter Zijlstra <peterz@infradead.org>,
Andrew Morton <akpm@linux-foundation.org>,
prasad@linux.vnet.ibm.com, "Frank Ch. Eigler" <fche@redhat.com>,
David Wilder <dwilder@us.ibm.com>,
hch@lst.de, Martin Bligh <mbligh@google.com>,
Christoph Hellwig <hch@infradead.org>,
Steven Rostedt <srostedt@redhat.com>
Subject: Re: [RFC PATCH 1/2 v2] Unified trace buffer
Date: Thu, 25 Sep 2008 14:25:17 -0400 [thread overview]
Message-ID: <20080925182517.GA6263@Krystal> (raw)
In-Reply-To: <alpine.DEB.1.10.0809251347000.29802@gandalf.stny.rr.com>
* Steven Rostedt (rostedt@goodmis.org) wrote:
>
> On Thu, 25 Sep 2008, Mathieu Desnoyers wrote:
> >
> > Is there a reason to use delta between events rather than simply write
> > the 27 LSBs that I would have missed ?
>
> One answer is that your counter wrap problem is extended.
>
> That is, you have 27 bits of time between each event to not worry about
> wraps. But if you go against the page itself, the last event on that page
> is more likely to suffer.
>
You can do the exact same thing and manage to keep the absolute time.
You just have to adapt the reader like this : (this would be for
per-event cycle count in the 32 LSBs, slight bitmask adaptation needed
for 27 bits only).
keep a 64 bits TSC value in a per-buffer variable. The previous value is
always re-used for the next read.
let's call it :
tf->buffer.tsc (u64)
read_event() would look like :
u32 timetamp = read_event_timetamp();
if(timestamp < (0xFFFFFFFFULL & tf->buffer.tsc)) {
/* overflow */
tf->buffer.tsc = ((tf->buffer.tsc & 0xFFFFFFFF00000000ULL)
+ 0x100000000ULL) | (u64)timestamp;
} else {
/* no overflow */
tf->buffer.tsc = (tf->buffer.tsc & 0xFFFFFFFF00000000ULL)
| (u64)timestamp;
}
This will detect 32 bits overflow and keep the tf->buffer.tsc in sync
with the TSC representation on the traced machine as long as events are
less then 27 bits apart. A "full tsc" header can also be easily managed
with this by updating the tf->buffer.tsc value completely when such
event is met.
Mathieu
> -- Steve
>
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
next prev parent reply other threads:[~2008-09-25 18:30 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-25 15:58 [RFC PATCH 0/2 v2] Unified trace buffer (take two) Steven Rostedt
2008-09-25 15:58 ` [RFC PATCH 1/2 v2] Unified trace buffer Steven Rostedt
2008-09-25 17:02 ` Linus Torvalds
2008-09-25 17:16 ` Steven Rostedt
2008-09-25 17:25 ` Linus Torvalds
2008-09-25 17:46 ` Steven Rostedt
2008-09-25 17:35 ` Mathieu Desnoyers
2008-09-25 17:48 ` Steven Rostedt
2008-09-25 18:25 ` Mathieu Desnoyers [this message]
2008-09-25 15:58 ` [RFC PATCH 2/2 v2] ftrace: make work with new ring buffer 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=20080925182517.GA6263@Krystal \
--to=compudj@krystal.dyndns.org \
--cc=akpm@linux-foundation.org \
--cc=dwilder@us.ibm.com \
--cc=fche@redhat.com \
--cc=hch@infradead.org \
--cc=hch@lst.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mbligh@google.com \
--cc=mingo@elte.hu \
--cc=peterz@infradead.org \
--cc=prasad@linux.vnet.ibm.com \
--cc=rostedt@goodmis.org \
--cc=srostedt@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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