aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorHe Kuang <hekuang@huawei.com>2015-05-28 09:17:30 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-06-08 09:30:32 -0400
commit457ae94ae047330e75c13f28ead6de31eab245ed (patch)
treeec525a71f8f7b573bb8c0b6dd5779844e7c4976d /tools/perf
parent38e096249b4fca1a26ca8908ea2018a5faf366e2 (diff)
perf record: Fix perf.data size in no-buildid mode
The size of perf.data is missing update in no-buildid mode, which gives wrong output result. Before this patch: $ perf.perf record -B -e syscalls:sys_enter_open uname Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.000 MB perf.data ] After this patch: $ perf.perf record -B -e syscalls:sys_enter_open uname Linux [ perf record: Woken up 1 times to write data ] [ perf record: Captured and wrote 0.001 MB perf.data ] Signed-off-by: He Kuang <hekuang@huawei.com> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <a.p.zijlstra@chello.nl> Cc: Wang Nan <wangnan0@huawei.com> Link: http://lkml.kernel.org/r/1432819050-30511-1-git-send-email-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/builtin-record.c6
1 files changed, 2 insertions, 4 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c
index 91aa2a3dcf19..d3731cce7c1c 100644
--- a/tools/perf/builtin-record.c
+++ b/tools/perf/builtin-record.c
@@ -345,12 +345,9 @@ static int process_buildids(struct record *rec)
345 struct perf_data_file *file = &rec->file; 345 struct perf_data_file *file = &rec->file;
346 struct perf_session *session = rec->session; 346 struct perf_session *session = rec->session;
347 347
348 u64 size = lseek(perf_data_file__fd(file), 0, SEEK_CUR); 348 if (file->size == 0)
349 if (size == 0)
350 return 0; 349 return 0;
351 350
352 file->size = size;
353
354 /* 351 /*
355 * During this process, it'll load kernel map and replace the 352 * During this process, it'll load kernel map and replace the
356 * dso->long_name to a real pathname it found. In this case 353 * dso->long_name to a real pathname it found. In this case
@@ -719,6 +716,7 @@ out_child:
719 716
720 if (!err && !file->is_pipe) { 717 if (!err && !file->is_pipe) {
721 rec->session->header.data_size += rec->bytes_written; 718 rec->session->header.data_size += rec->bytes_written;
719 file->size = lseek(perf_data_file__fd(file), 0, SEEK_CUR);
722 720
723 if (!rec->no_buildid) { 721 if (!rec->no_buildid) {
724 process_buildids(rec); 722 process_buildids(rec);