lkml.org 
[lkml]   [2008]   [Sep]   [25]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [RFC PATCH 1/2 v2] Unified trace buffer
* 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


\
 
 \ /
  Last update: 2008-09-25 20:33    [W:0.049 / U:0.024 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site