- /* 32 bits -> 64 bits tsc */
- /* note : still works for seek and non seek cases. */
- if(event->timestamp < (0xFFFFFFFFULL&tf->buffer.tsc)) {
- tf->buffer.tsc = ((tf->buffer.tsc&0xFFFFFFFF00000000ULL)
- + 0x100000000ULL)
- | (guint64)event->timestamp;
- event->tsc = tf->buffer.tsc;
- } else {
- /* no overflow */
- tf->buffer.tsc = (tf->buffer.tsc&0xFFFFFFFF00000000ULL)
- | (guint64)event->timestamp;
- event->tsc = tf->buffer.tsc;
- }
+ if(!tf->compact) {
+ /* 32 bits -> 64 bits tsc */
+ /* note : still works for seek and non seek cases. */
+ if(event->timestamp < (0xFFFFFFFFULL&tf->buffer.tsc)) {
+ tf->buffer.tsc = ((tf->buffer.tsc&0xFFFFFFFF00000000ULL)
+ + 0x100000000ULL)
+ | (guint64)event->timestamp;
+ event->tsc = tf->buffer.tsc;
+ } else {
+ /* no overflow */
+ tf->buffer.tsc = (tf->buffer.tsc&0xFFFFFFFF00000000ULL)
+ | (guint64)event->timestamp;
+ event->tsc = tf->buffer.tsc;
+ }
+ } else {
+ /* Compact header */
+ /* We keep the LSB of the previous timestamp, to make sure
+ * we never go back */
+ event->event_id = event->timestamp >> tf->tscbits;
+ event->event_size = 0xFFFF;
+ printf("Found compact event %d\n", event->event_id);
+ event->timestamp = event->timestamp << tf->tsc_lsb_truncate;
+ event->timestamp = event->timestamp & tf->tsc_mask;
+ printf("timestamp 0x%lX\n", event->timestamp);
+ printf("mask 0x%llX\n", tf->tsc_mask);
+ printf("mask_next 0x%llX\n", tf->tsc_mask_next_bit);
+ printf("previous tsc 0x%llX\n", tf->buffer.tsc);
+ printf("previous tsc&mask 0x%llX\n", tf->tsc_mask&tf->buffer.tsc);
+ printf("previous tsc&(~mask) 0x%llX\n", tf->buffer.tsc&(~tf->tsc_mask));
+ if(event->timestamp < (tf->tsc_mask&tf->buffer.tsc)) {
+ printf("wrap\n");
+ tf->buffer.tsc = ((tf->buffer.tsc&(~tf->tsc_mask))
+ + tf->tsc_mask_next_bit)
+ | (guint64)event->timestamp;
+ event->tsc = tf->buffer.tsc;
+ } else {
+ printf("no wrap\n");
+ /* no overflow */
+ tf->buffer.tsc = (tf->buffer.tsc&(~tf->tsc_mask))
+ | (guint64)event->timestamp;
+ event->tsc = tf->buffer.tsc;
+ }
+ printf("current tsc 0x%llX\n", tf->buffer.tsc);
+ g_assert(tf->trace->compact_facilities);
+ /* FIXME : currently does not support unload/load of compact
+ * facility during tracing. Should check for the currently loaded
+ * version of the facility. */
+ g_assert(tf->trace->compact_facilities->len == 1);
+ event->facility_id = g_array_index(tf->trace->compact_facilities, guint, 0);
+ }