diff options
author | Frederic Weisbecker <fweisbec@gmail.com> | 2009-08-16 16:05:48 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-08-16 17:06:45 -0400 |
commit | 8f28827a162fd1e8da4e96bed69b06d2606e8322 (patch) | |
tree | b57a24ca7819a1b347374aa62dd90444740811f8 /tools/perf/builtin-report.c | |
parent | 0d3a5c885971de1e3124d85bfadf818abac9ba12 (diff) |
perf tools: Librarize trace_event() helper
Librarize trace_event() helper so that perf trace can use it
too. Also clean up the debug.h includes a bit.
It's not good to have it included in perf.h because it doesn't
make it flexible against other headers it may need (headers
that can also depend on perf.h and then create a recursive
header dependency).
Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Mike Galbraith <efault@gmx.de>
LKML-Reference: <1250453149-664-1-git-send-email-fweisbec@gmail.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 39 |
1 files changed, 1 insertions, 38 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index c6326deb1636..1e3ad22d53dc 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -20,6 +20,7 @@ | |||
20 | #include "util/values.h" | 20 | #include "util/values.h" |
21 | 21 | ||
22 | #include "perf.h" | 22 | #include "perf.h" |
23 | #include "util/debug.h" | ||
23 | #include "util/header.h" | 24 | #include "util/header.h" |
24 | 25 | ||
25 | #include "util/parse-options.h" | 26 | #include "util/parse-options.h" |
@@ -39,8 +40,6 @@ static char *field_sep; | |||
39 | static int input; | 40 | static int input; |
40 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; | 41 | static int show_mask = SHOW_KERNEL | SHOW_USER | SHOW_HV; |
41 | 42 | ||
42 | #define cdprintf(x...) do { if (dump_trace) color_fprintf(stdout, color, x); } while (0) | ||
43 | |||
44 | static int full_paths; | 43 | static int full_paths; |
45 | static int show_nr_samples; | 44 | static int show_nr_samples; |
46 | 45 | ||
@@ -1285,42 +1284,6 @@ process_lost_event(event_t *event, unsigned long offset, unsigned long head) | |||
1285 | return 0; | 1284 | return 0; |
1286 | } | 1285 | } |
1287 | 1286 | ||
1288 | static void trace_event(event_t *event) | ||
1289 | { | ||
1290 | unsigned char *raw_event = (void *)event; | ||
1291 | const char *color = PERF_COLOR_BLUE; | ||
1292 | int i, j; | ||
1293 | |||
1294 | if (!dump_trace) | ||
1295 | return; | ||
1296 | |||
1297 | dump_printf("."); | ||
1298 | cdprintf("\n. ... raw event: size %d bytes\n", event->header.size); | ||
1299 | |||
1300 | for (i = 0; i < event->header.size; i++) { | ||
1301 | if ((i & 15) == 0) { | ||
1302 | dump_printf("."); | ||
1303 | cdprintf(" %04x: ", i); | ||
1304 | } | ||
1305 | |||
1306 | cdprintf(" %02x", raw_event[i]); | ||
1307 | |||
1308 | if (((i & 15) == 15) || i == event->header.size-1) { | ||
1309 | cdprintf(" "); | ||
1310 | for (j = 0; j < 15-(i & 15); j++) | ||
1311 | cdprintf(" "); | ||
1312 | for (j = 0; j < (i & 15); j++) { | ||
1313 | if (isprint(raw_event[i-15+j])) | ||
1314 | cdprintf("%c", raw_event[i-15+j]); | ||
1315 | else | ||
1316 | cdprintf("."); | ||
1317 | } | ||
1318 | cdprintf("\n"); | ||
1319 | } | ||
1320 | } | ||
1321 | dump_printf(".\n"); | ||
1322 | } | ||
1323 | |||
1324 | static int | 1287 | static int |
1325 | process_read_event(event_t *event, unsigned long offset, unsigned long head) | 1288 | process_read_event(event_t *event, unsigned long offset, unsigned long head) |
1326 | { | 1289 | { |