1 /* For general debugging purposes */
17 bool dump_trace
= false, quiet
= false;
19 static int _eprintf(int level
, const char *fmt
, va_list args
)
23 if (verbose
>= level
) {
25 ui_helpline__vshow(fmt
, args
);
27 ret
= vfprintf(stderr
, fmt
, args
);
33 int eprintf(int level
, const char *fmt
, ...)
39 ret
= _eprintf(level
, fmt
, args
);
46 * Overloading libtraceevent standard info print
47 * function, display with -v in perf.
49 void pr_stat(const char *fmt
, ...)
54 _eprintf(1, fmt
, args
);
59 int dump_printf(const char *fmt
, ...)
66 ret
= vprintf(fmt
, args
);
73 void trace_event(union perf_event
*event
)
75 unsigned char *raw_event
= (void *)event
;
76 const char *color
= PERF_COLOR_BLUE
;
83 color_fprintf(stdout
, color
, "\n. ... raw event: size %d bytes\n",
86 for (i
= 0; i
< event
->header
.size
; i
++) {
89 color_fprintf(stdout
, color
, " %04x: ", i
);
92 color_fprintf(stdout
, color
, " %02x", raw_event
[i
]);
94 if (((i
& 15) == 15) || i
== event
->header
.size
-1) {
95 color_fprintf(stdout
, color
, " ");
96 for (j
= 0; j
< 15-(i
& 15); j
++)
97 color_fprintf(stdout
, color
, " ");
98 for (j
= i
& ~15; j
<= i
; j
++) {
99 color_fprintf(stdout
, color
, "%c",
100 isprint(raw_event
[j
]) ?
103 color_fprintf(stdout
, color
, "\n");