1 /* For general debugging purposes */
16 bool dump_trace = false;
18 int eprintf(int level, const char *fmt, ...)
23 if (verbose >= level) {
26 ret = browser__show_help(fmt, args);
28 ret = vfprintf(stderr, fmt, args);
35 int dump_printf(const char *fmt, ...)
42 ret = vprintf(fmt, args);
49 static int dump_printf_color(const char *fmt, const char *color, ...)
55 va_start(args, color);
56 ret = color_vfprintf(stdout, color, fmt, args);
64 void trace_event(event_t *event)
66 unsigned char *raw_event = (void *)event;
67 const char *color = PERF_COLOR_BLUE;
74 dump_printf_color("\n. ... raw event: size %d bytes\n", color,
77 for (i = 0; i < event->header.size; i++) {
80 dump_printf_color(" %04x: ", color, i);
83 dump_printf_color(" %02x", color, raw_event[i]);
85 if (((i & 15) == 15) || i == event->header.size-1) {
86 dump_printf_color(" ", color);
87 for (j = 0; j < 15-(i & 15); j++)
88 dump_printf_color(" ", color);
89 for (j = 0; j < (i & 15); j++) {
90 if (isprint(raw_event[i-15+j]))
91 dump_printf_color("%c", color,
94 dump_printf_color(".", color);
96 dump_printf_color("\n", color);