+static int
+process_lost_event(event_t *event, unsigned long offset, unsigned long head)
+{
+ dprintf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ event->lost.id,
+ event->lost.lost);
+
+ total_lost += event->lost.lost;
+
+ return 0;
+}
+
+static void trace_event(event_t *event)
+{
+ unsigned char *raw_event = (void *)event;
+ char *color = PERF_COLOR_BLUE;
+ int i, j;
+
+ if (!dump_trace)
+ return;
+
+ dprintf(".");
+ cdprintf("\n. ... raw event: size %d bytes\n", event->header.size);
+
+ for (i = 0; i < event->header.size; i++) {
+ if ((i & 15) == 0) {
+ dprintf(".");
+ cdprintf(" %04x: ", i);
+ }
+
+ cdprintf(" %02x", raw_event[i]);
+
+ if (((i & 15) == 15) || i == event->header.size-1) {
+ cdprintf(" ");
+ for (j = 0; j < 15-(i & 15); j++)
+ cdprintf(" ");
+ for (j = 0; j < (i & 15); j++) {
+ if (isprint(raw_event[i-15+j]))
+ cdprintf("%c", raw_event[i-15+j]);
+ else
+ cdprintf(".");
+ }
+ cdprintf("\n");
+ }
+ }
+ dprintf(".\n");
+}
+
+static int
+process_read_event(event_t *event, unsigned long offset, unsigned long head)
+{
+ dprintf("%p [%p]: PERF_EVENT_READ: %d %d %Lu\n",
+ (void *)(offset + head),
+ (void *)(long)(event->header.size),
+ event->read.pid,
+ event->read.tid,
+ event->read.value);
+
+ return 0;
+}
+