1 /* For general debugging purposes */
16 int eprintf(const char *fmt
, ...)
23 ret
= vfprintf(stderr
, fmt
, args
);
30 int dump_printf(const char *fmt
, ...)
37 ret
= vprintf(fmt
, args
);
44 static int dump_printf_color(const char *fmt
, const char *color
, ...)
50 va_start(args
, color
);
51 ret
= color_vfprintf(stdout
, color
, fmt
, args
);
59 void trace_event(event_t
*event
)
61 unsigned char *raw_event
= (void *)event
;
62 const char *color
= PERF_COLOR_BLUE
;
69 dump_printf_color("\n. ... raw event: size %d bytes\n", color
,
72 for (i
= 0; i
< event
->header
.size
; i
++) {
75 dump_printf_color(" %04x: ", color
, i
);
78 dump_printf_color(" %02x", color
, raw_event
[i
]);
80 if (((i
& 15) == 15) || i
== event
->header
.size
-1) {
81 dump_printf_color(" ", color
);
82 for (j
= 0; j
< 15-(i
& 15); j
++)
83 dump_printf_color(" ", color
);
84 for (j
= 0; j
< (i
& 15); j
++) {
85 if (isprint(raw_event
[i
-15+j
]))
86 dump_printf_color("%c", color
,
89 dump_printf_color(".", color
);
91 dump_printf_color("\n", color
);