From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933193AbbFIJxT (ORCPT ); Tue, 9 Jun 2015 05:53:19 -0400 Received: from terminus.zytor.com ([198.137.202.10]:49637 "EHLO terminus.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932925AbbFIJw6 (ORCPT ); Tue, 9 Jun 2015 05:52:58 -0400 Date: Tue, 9 Jun 2015 02:52:33 -0700 From: tip-bot for He Kuang Message-ID: Cc: wangnan0@huawei.com, mingo@kernel.org, namhyung@kernel.org, acme@redhat.com, hekuang@huawei.com, a.p.zijlstra@chello.nl, tglx@linutronix.de, linux-kernel@vger.kernel.org, hpa@zytor.com Reply-To: acme@redhat.com, namhyung@kernel.org, hpa@zytor.com, linux-kernel@vger.kernel.org, a.p.zijlstra@chello.nl, tglx@linutronix.de, hekuang@huawei.com, wangnan0@huawei.com, mingo@kernel.org In-Reply-To: <1432819050-30511-1-git-send-email-hekuang@huawei.com> References: <1432819050-30511-1-git-send-email-hekuang@huawei.com> To: linux-tip-commits@vger.kernel.org Subject: [tip:perf/core] perf record: Fix perf.data size in no-buildid mode Git-Commit-ID: 457ae94ae047330e75c13f28ead6de31eab245ed X-Mailer: tip-git-log-daemon Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset=UTF-8 Content-Disposition: inline Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit-ID: 457ae94ae047330e75c13f28ead6de31eab245ed Gitweb: http://git.kernel.org/tip/457ae94ae047330e75c13f28ead6de31eab245ed Author: He Kuang AuthorDate: Thu, 28 May 2015 13:17:30 +0000 Committer: Arnaldo Carvalho de Melo CommitDate: Mon, 8 Jun 2015 10:30:32 -0300 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 Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Wang Nan Link: http://lkml.kernel.org/r/1432819050-30511-1-git-send-email-hekuang@huawei.com Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-record.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 91aa2a3..d3731cc 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c @@ -345,12 +345,9 @@ static int process_buildids(struct record *rec) struct perf_data_file *file = &rec->file; struct perf_session *session = rec->session; - u64 size = lseek(perf_data_file__fd(file), 0, SEEK_CUR); - if (size == 0) + if (file->size == 0) return 0; - file->size = size; - /* * During this process, it'll load kernel map and replace the * dso->long_name to a real pathname it found. In this case @@ -719,6 +716,7 @@ out_child: if (!err && !file->is_pipe) { rec->session->header.data_size += rec->bytes_written; + file->size = lseek(perf_data_file__fd(file), 0, SEEK_CUR); if (!rec->no_buildid) { process_buildids(rec);