1 /* For general debugging purposes */
17 bool dump_trace
= false, quiet
= false;
19 int eprintf(int level
, const char *fmt
, ...)
24 if (verbose
>= level
) {
27 ui_helpline__vshow(fmt
, args
);
29 ret
= vfprintf(stderr
, fmt
, args
);
36 int dump_printf(const char *fmt
, ...)
43 ret
= vprintf(fmt
, args
);
50 void trace_event(union perf_event
*event
)
52 unsigned char *raw_event
= (void *)event
;
53 const char *color
= PERF_COLOR_BLUE
;
60 color_fprintf(stdout
, color
, "\n. ... raw event: size %d bytes\n",
63 for (i
= 0; i
< event
->header
.size
; i
++) {
66 color_fprintf(stdout
, color
, " %04x: ", i
);
69 color_fprintf(stdout
, color
, " %02x", raw_event
[i
]);
71 if (((i
& 15) == 15) || i
== event
->header
.size
-1) {
72 color_fprintf(stdout
, color
, " ");
73 for (j
= 0; j
< 15-(i
& 15); j
++)
74 color_fprintf(stdout
, color
, " ");
75 for (j
= i
& ~15; j
<= i
; j
++) {
76 color_fprintf(stdout
, color
, "%c",
77 isprint(raw_event
[j
]) ?
80 color_fprintf(stdout
, color
, "\n");