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 ret
= ui_helpline__show_help(fmt
, args
);
29 ret
= vfprintf(stderr
, fmt
, args
);
36 int dump_printf(const char *fmt
, ...)
43 ret
= vprintf(fmt
, args
);
50 #if defined(NO_NEWT_SUPPORT) && defined(NO_GTK2_SUPPORT)
51 int ui__warning(const char *format
, ...)
55 va_start(args
, format
);
56 vfprintf(stderr
, format
, args
);
62 int ui__error_paranoid(void)
64 return ui__error("Permission error - are you root?\n"
65 "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
66 " -1 - Not paranoid at all\n"
67 " 0 - Disallow raw tracepoint access for unpriv\n"
68 " 1 - Disallow cpu events for unpriv\n"
69 " 2 - Disallow kernel profiling for unpriv\n");
72 void trace_event(union perf_event
*event
)
74 unsigned char *raw_event
= (void *)event
;
75 const char *color
= PERF_COLOR_BLUE
;
82 color_fprintf(stdout
, color
, "\n. ... raw event: size %d bytes\n",
85 for (i
= 0; i
< event
->header
.size
; i
++) {
88 color_fprintf(stdout
, color
, " %04x: ", i
);
91 color_fprintf(stdout
, color
, " %02x", raw_event
[i
]);
93 if (((i
& 15) == 15) || i
== event
->header
.size
-1) {
94 color_fprintf(stdout
, color
, " ");
95 for (j
= 0; j
< 15-(i
& 15); j
++)
96 color_fprintf(stdout
, color
, " ");
97 for (j
= i
& ~15; j
<= i
; j
++) {
98 color_fprintf(stdout
, color
, "%c",
99 isprint(raw_event
[j
]) ?
102 color_fprintf(stdout
, color
, "\n");