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
);
28 else if (use_browser
== 2)
29 ret
= perf_gtk__show_helpline(fmt
, args
);
31 ret
= vfprintf(stderr
, fmt
, args
);
38 int dump_printf(const char *fmt
, ...)
45 ret
= vprintf(fmt
, args
);
52 #if !defined(NEWT_SUPPORT) && !defined(GTK2_SUPPORT)
53 int ui__warning(const char *format
, ...)
57 va_start(args
, format
);
58 vfprintf(stderr
, format
, args
);
64 int ui__error_paranoid(void)
66 return ui__error("Permission error - are you root?\n"
67 "Consider tweaking /proc/sys/kernel/perf_event_paranoid:\n"
68 " -1 - Not paranoid at all\n"
69 " 0 - Disallow raw tracepoint access for unpriv\n"
70 " 1 - Disallow cpu events for unpriv\n"
71 " 2 - Disallow kernel profiling for unpriv\n");
74 void trace_event(union perf_event
*event
)
76 unsigned char *raw_event
= (void *)event
;
77 const char *color
= PERF_COLOR_BLUE
;
84 color_fprintf(stdout
, color
, "\n. ... raw event: size %d bytes\n",
87 for (i
= 0; i
< event
->header
.size
; i
++) {
90 color_fprintf(stdout
, color
, " %04x: ", i
);
93 color_fprintf(stdout
, color
, " %02x", raw_event
[i
]);
95 if (((i
& 15) == 15) || i
== event
->header
.size
-1) {
96 color_fprintf(stdout
, color
, " ");
97 for (j
= 0; j
< 15-(i
& 15); j
++)
98 color_fprintf(stdout
, color
, " ");
99 for (j
= i
& ~15; j
<= i
; j
++) {
100 color_fprintf(stdout
, color
, "%c",
101 isprint(raw_event
[j
]) ?
104 color_fprintf(stdout
, color
, "\n");