1 /* For general debugging purposes */
17 bool dump_trace = false, quiet = false;
19 static int _eprintf(int level, int var, const char *fmt, va_list args)
25 ui_helpline__vshow(fmt, args);
27 ret = vfprintf(stderr, fmt, args);
33 int eprintf(int level, int var, const char *fmt, ...)
39 ret = _eprintf(level, var, 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, verbose, fmt, args);
56 eprintf(1, verbose, "\n");
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");
109 static struct debug_variable {
112 } debug_variables[] = {
113 { .name = "verbose", .ptr = &verbose },
117 int perf_debug_option(const char *str)
119 struct debug_variable *var = &debug_variables[0];
120 char *vstr, *s = strdup(str);
123 vstr = strchr(s, '=');
128 if (!strcmp(s, var->name))
134 pr_err("Unknown debug variable name '%s'\n", s);
142 * Allow only values in range (0, 10),
145 v = (v < 0) || (v > 10) ? 0 : v;