1 /* For general debugging purposes */
17 int eprintf(int level
, const char *fmt
, ...)
22 if (verbose
>= level
) {
24 ret
= vfprintf(stderr
, fmt
, args
);
31 int dump_printf(const char *fmt
, ...)
38 ret
= vprintf(fmt
, args
);
45 static int dump_printf_color(const char *fmt
, const char *color
, ...)
51 va_start(args
, color
);
52 ret
= color_vfprintf(stdout
, color
, fmt
, args
);
60 void trace_event(event_t
*event
)
62 unsigned char *raw_event
= (void *)event
;
63 const char *color
= PERF_COLOR_BLUE
;
70 dump_printf_color("\n. ... raw event: size %d bytes\n", color
,
73 for (i
= 0; i
< event
->header
.size
; i
++) {
76 dump_printf_color(" %04x: ", color
, i
);
79 dump_printf_color(" %02x", color
, raw_event
[i
]);
81 if (((i
& 15) == 15) || i
== event
->header
.size
-1) {
82 dump_printf_color(" ", color
);
83 for (j
= 0; j
< 15-(i
& 15); j
++)
84 dump_printf_color(" ", color
);
85 for (j
= 0; j
< (i
& 15); j
++) {
86 if (isprint(raw_event
[i
-15+j
]))
87 dump_printf_color("%c", color
,
90 dump_printf_color(".", color
);
92 dump_printf_color("\n", color
);