[ltt-dev] [PATCH] Fix bug in lttv from 0.12.0 to 0.12.10
Mathieu Desnoyers
mathieu.desnoyers at polymtl.ca
Wed Feb 18 00:31:31 EST 2009
Hi,
I found a nasty event id / timetamping bug in lttv. Basically, when
enough events were registered in a channel to come up to IDs 29, 30 and
31, there were side-effects on how the timestamp update was done for the
specific event because the event id was overwritten by the case 29: in
the switch() before the test done later in a if() statement. LTTV
0.12.11 fixes this. For reference, here is the diff.
Mathieu, getting back to timestamp-sanity land.
Index: tracefile.c
===================================================================
--- tracefile.c (revision 3321)
+++ tracefile.c (working copy)
@@ -1256,6 +1256,7 @@
void * pos;
LttEvent *event;
void *pos_aligned;
+ guint16 packed_evid; /* event id reader from the 5 bits in header */
event = &tf->event;
pos = tf->buffer.head + event->offset;
@@ -1267,11 +1268,11 @@
pos_aligned = pos;
event->timestamp = ltt_get_uint32(LTT_GET_BO(tf), pos);
- event->event_id = event->timestamp >> tf->tscbits;
+ event->event_id = packed_evid = event->timestamp >> tf->tscbits;
event->timestamp = event->timestamp & tf->tsc_mask;
pos += sizeof(guint32);
- switch (event->event_id) {
+ switch (packed_evid) {
case 29: /* LTT_RFLAG_ID_SIZE_TSC */
event->event_id = ltt_get_uint16(LTT_GET_BO(tf), pos);
pos += sizeof(guint16);
@@ -1305,7 +1306,7 @@
break;
}
- if (likely(event->event_id != 29)) {
+ if (likely(packed_evid != 29)) {
/* No extended timestamp */
if (event->timestamp < (tf->buffer.tsc & tf->tsc_mask))
tf->buffer.tsc = ((tf->buffer.tsc & ~tf->tsc_mask) /* overflow */
--
Mathieu Desnoyers
OpenPGP key fingerprint: 8CD5 52C3 8E3C 4140 715F BA06 3F25 A8FE 3BAE 9A68
More information about the lttng-dev
mailing list