diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-06-18 17:22:55 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-19 07:42:36 -0400 |
commit | f5970550d5ccf90453cbd7d260370ea99d1f6513 (patch) | |
tree | f09c265d9c44bf0cb74d5e998626c6dede5e14c9 /tools/perf/builtin-report.c | |
parent | 2a0a50fe9def21835d65035cc8109c0b6dd6099d (diff) |
perf_counter tools: Add a data file header
Add a data file header so we can transfer data between record and report.
LKML-Reference: <new-submission>
Signed-off-by: Peter Zijlstra <a.p.zijlstra@chello.nl>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 7a6577bf9a41..37b26ecb0d0b 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -1366,11 +1366,13 @@ process_event(event_t *event, unsigned long offset, unsigned long head) | |||
1366 | return 0; | 1366 | return 0; |
1367 | } | 1367 | } |
1368 | 1368 | ||
1369 | static struct perf_file_header file_header; | ||
1370 | |||
1369 | static int __cmd_report(void) | 1371 | static int __cmd_report(void) |
1370 | { | 1372 | { |
1371 | int ret, rc = EXIT_FAILURE; | 1373 | int ret, rc = EXIT_FAILURE; |
1372 | unsigned long offset = 0; | 1374 | unsigned long offset = 0; |
1373 | unsigned long head = 0; | 1375 | unsigned long head = sizeof(file_header); |
1374 | struct stat stat; | 1376 | struct stat stat; |
1375 | event_t *event; | 1377 | event_t *event; |
1376 | uint32_t size; | 1378 | uint32_t size; |
@@ -1398,6 +1400,14 @@ static int __cmd_report(void) | |||
1398 | exit(0); | 1400 | exit(0); |
1399 | } | 1401 | } |
1400 | 1402 | ||
1403 | read(input, &file_header, sizeof(file_header)); | ||
1404 | |||
1405 | if (sort__has_parent && | ||
1406 | !(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) { | ||
1407 | fprintf(stderr, "selected --sort parent, but no callchain data\n"); | ||
1408 | exit(-1); | ||
1409 | } | ||
1410 | |||
1401 | if (load_kernel() < 0) { | 1411 | if (load_kernel() < 0) { |
1402 | perror("failed to load kernel symbols"); | 1412 | perror("failed to load kernel symbols"); |
1403 | return EXIT_FAILURE; | 1413 | return EXIT_FAILURE; |
@@ -1469,9 +1479,13 @@ more: | |||
1469 | 1479 | ||
1470 | head += size; | 1480 | head += size; |
1471 | 1481 | ||
1482 | if (offset + head >= sizeof(file_header) + file_header.data_size) | ||
1483 | goto done; | ||
1484 | |||
1472 | if (offset + head < stat.st_size) | 1485 | if (offset + head < stat.st_size) |
1473 | goto more; | 1486 | goto more; |
1474 | 1487 | ||
1488 | done: | ||
1475 | rc = EXIT_SUCCESS; | 1489 | rc = EXIT_SUCCESS; |
1476 | close(input); | 1490 | close(input); |
1477 | 1491 | ||