summaryrefslogtreecommitdiffstats
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-18 23:22:55 +0200
committerIngo Molnar <mingo@elte.hu>2009-06-19 13:42:36 +0200
commitf5970550d5ccf90453cbd7d260370ea99d1f6513 (patch)
treef09c265d9c44bf0cb74d5e998626c6dede5e14c9 /tools/perf/builtin-report.c
parent2a0a50fe9def21835d65035cc8109c0b6dd6099d (diff)
downloadlinux-f5970550d5ccf90453cbd7d260370ea99d1f6513.tar.bz2
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.c16
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)
return 0;
}
+static struct perf_file_header file_header;
+
static int __cmd_report(void)
{
int ret, rc = EXIT_FAILURE;
unsigned long offset = 0;
- unsigned long head = 0;
+ unsigned long head = sizeof(file_header);
struct stat stat;
event_t *event;
uint32_t size;
@@ -1398,6 +1400,14 @@ static int __cmd_report(void)
exit(0);
}
+ read(input, &file_header, sizeof(file_header));
+
+ if (sort__has_parent &&
+ !(file_header.sample_type & PERF_SAMPLE_CALLCHAIN)) {
+ fprintf(stderr, "selected --sort parent, but no callchain data\n");
+ exit(-1);
+ }
+
if (load_kernel() < 0) {
perror("failed to load kernel symbols");
return EXIT_FAILURE;
@@ -1469,9 +1479,13 @@ more:
head += size;
+ if (offset + head >= sizeof(file_header) + file_header.data_size)
+ goto done;
+
if (offset + head < stat.st_size)
goto more;
+done:
rc = EXIT_SUCCESS;
close(input);