diff options
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/debug.c | 41 |
1 files changed, 13 insertions, 28 deletions
diff --git a/tools/perf/util/debug.c b/tools/perf/util/debug.c index e5161e8f9915..01bbe8ecec3f 100644 --- a/tools/perf/util/debug.c +++ b/tools/perf/util/debug.c | |||
@@ -57,21 +57,6 @@ void ui__warning(const char *format, ...) | |||
57 | } | 57 | } |
58 | #endif | 58 | #endif |
59 | 59 | ||
60 | static int dump_printf_color(const char *fmt, const char *color, ...) | ||
61 | { | ||
62 | va_list args; | ||
63 | int ret = 0; | ||
64 | |||
65 | if (dump_trace) { | ||
66 | va_start(args, color); | ||
67 | ret = color_vfprintf(stdout, color, fmt, args); | ||
68 | va_end(args); | ||
69 | } | ||
70 | |||
71 | return ret; | ||
72 | } | ||
73 | |||
74 | |||
75 | void trace_event(event_t *event) | 60 | void trace_event(event_t *event) |
76 | { | 61 | { |
77 | unsigned char *raw_event = (void *)event; | 62 | unsigned char *raw_event = (void *)event; |
@@ -81,29 +66,29 @@ void trace_event(event_t *event) | |||
81 | if (!dump_trace) | 66 | if (!dump_trace) |
82 | return; | 67 | return; |
83 | 68 | ||
84 | dump_printf("."); | 69 | printf("."); |
85 | dump_printf_color("\n. ... raw event: size %d bytes\n", color, | 70 | color_fprintf(stdout, color, "\n. ... raw event: size %d bytes\n", |
86 | event->header.size); | 71 | event->header.size); |
87 | 72 | ||
88 | for (i = 0; i < event->header.size; i++) { | 73 | for (i = 0; i < event->header.size; i++) { |
89 | if ((i & 15) == 0) { | 74 | if ((i & 15) == 0) { |
90 | dump_printf("."); | 75 | printf("."); |
91 | dump_printf_color(" %04x: ", color, i); | 76 | color_fprintf(stdout, color, " %04x: ", i); |
92 | } | 77 | } |
93 | 78 | ||
94 | dump_printf_color(" %02x", color, raw_event[i]); | 79 | color_fprintf(stdout, color, " %02x", raw_event[i]); |
95 | 80 | ||
96 | if (((i & 15) == 15) || i == event->header.size-1) { | 81 | if (((i & 15) == 15) || i == event->header.size-1) { |
97 | dump_printf_color(" ", color); | 82 | color_fprintf(stdout, color, " "); |
98 | for (j = 0; j < 15-(i & 15); j++) | 83 | for (j = 0; j < 15-(i & 15); j++) |
99 | dump_printf_color(" ", color); | 84 | color_fprintf(stdout, color, " "); |
100 | for (j = i & ~15; j <= i; j++) { | 85 | for (j = i & ~15; j <= i; j++) { |
101 | dump_printf_color("%c", color, | 86 | color_fprintf(stdout, color, "%c", |
102 | isprint(raw_event[j]) ? | 87 | isprint(raw_event[j]) ? |
103 | raw_event[j] : '.'); | 88 | raw_event[j] : '.'); |
104 | } | 89 | } |
105 | dump_printf_color("\n", color); | 90 | color_fprintf(stdout, color, "\n"); |
106 | } | 91 | } |
107 | } | 92 | } |
108 | dump_printf(".\n"); | 93 | printf(".\n"); |
109 | } | 94 | } |