All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] perf record: Fix perf.data size in no-buildid mode
@ 2015-05-28 13:17 He Kuang
  2015-06-05 11:40 ` He Kuang
  2015-06-09  9:52 ` [tip:perf/core] " tip-bot for He Kuang
  0 siblings, 2 replies; 4+ messages in thread
From: He Kuang @ 2015-05-28 13:17 UTC (permalink / raw)
  To: acme, mingo, a.p.zijlstra, namhyung; +Cc: wangnan0, linux-kernel

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>
---
 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);
-- 
1.8.5.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf record: Fix perf.data size in no-buildid mode
  2015-05-28 13:17 [PATCH] perf record: Fix perf.data size in no-buildid mode He Kuang
@ 2015-06-05 11:40 ` He Kuang
  2015-06-05 14:44   ` Arnaldo Carvalho de Melo
  2015-06-09  9:52 ` [tip:perf/core] " tip-bot for He Kuang
  1 sibling, 1 reply; 4+ messages in thread
From: He Kuang @ 2015-06-05 11:40 UTC (permalink / raw)
  To: acme, mingo, a.p.zijlstra, namhyung; +Cc: wangnan0, linux-kernel


ping..
On 2015/5/28 21:17, He Kuang wrote:
> 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>
> ---
>   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);
>


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] perf record: Fix perf.data size in no-buildid mode
  2015-06-05 11:40 ` He Kuang
@ 2015-06-05 14:44   ` Arnaldo Carvalho de Melo
  0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2015-06-05 14:44 UTC (permalink / raw)
  To: He Kuang; +Cc: mingo, a.p.zijlstra, namhyung, wangnan0, linux-kernel

Em Fri, Jun 05, 2015 at 07:40:16PM +0800, He Kuang escreveu:
> 
> ping..

Thanks, applied.

- Arnaldo

> On 2015/5/28 21:17, He Kuang wrote:
> >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>
> >---
> >  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);
> >

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [tip:perf/core] perf record: Fix perf.data size in no-buildid mode
  2015-05-28 13:17 [PATCH] perf record: Fix perf.data size in no-buildid mode He Kuang
  2015-06-05 11:40 ` He Kuang
@ 2015-06-09  9:52 ` tip-bot for He Kuang
  1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for He Kuang @ 2015-06-09  9:52 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: wangnan0, mingo, namhyung, acme, hekuang, a.p.zijlstra, tglx,
	linux-kernel, hpa

Commit-ID:  457ae94ae047330e75c13f28ead6de31eab245ed
Gitweb:     http://git.kernel.org/tip/457ae94ae047330e75c13f28ead6de31eab245ed
Author:     He Kuang <hekuang@huawei.com>
AuthorDate: Thu, 28 May 2015 13:17:30 +0000
Committer:  Arnaldo Carvalho de Melo <acme@redhat.com>
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 <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>
---
 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);

^ permalink raw reply related	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-06-09  9:53 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-05-28 13:17 [PATCH] perf record: Fix perf.data size in no-buildid mode He Kuang
2015-06-05 11:40 ` He Kuang
2015-06-05 14:44   ` Arnaldo Carvalho de Melo
2015-06-09  9:52 ` [tip:perf/core] " tip-bot for He Kuang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.