LKML Archive on lore.kernel.org
help / color / mirror / Atom feed
* [PATCH] perf: annotate: make it respect -i option.
@ 2015-04-02  6:04 Wang Nan
  2015-04-02  8:12 ` Namhyung Kim
  2015-04-02  8:24 ` [PATCH] perf kmem: Respect " Jiri Olsa
  0 siblings, 2 replies; 4+ messages in thread
From: Wang Nan @ 2015-04-02  6:04 UTC (permalink / raw)
  To: acme, jolsa, namhyung; +Cc: mingo, lizefan, pi3orama, linux-kernel

There is a bug in perf annotate that it doesn't respect user provided
'-i'/'--input' option:

 # perf record ls
   [ perf record: Woken up 1 times to write data ]
   [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
 # mv ./perf.data ./perf.data.new
 # perf annotate -i ./perf.data.new  --stdio
   failed to open perf.data: No such file or directory  (try 'perf record' first)

This patch fix it by setting file path after option parsing, like
what 'perf report' does.

Signed-off-by: Wang Nan <wangnan0@huawei.com>
---
 tools/perf/builtin-annotate.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 71bf745..929f83c 100644
--- a/tools/perf/builtin-annotate.c
+++ b/tools/perf/builtin-annotate.c
@@ -283,7 +283,6 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
 		},
 	};
 	struct perf_data_file file = {
-		.path  = input_name,
 		.mode  = PERF_DATA_MODE_READ,
 	};
 	const struct option options[] = {
@@ -342,6 +341,7 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	setup_browser(true);
 
+	file.path  = input_name,
 	annotate.session = perf_session__new(&file, false, &annotate.tool);
 	if (annotate.session == NULL)
 		return -1;
-- 
1.8.3.4


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

* Re: [PATCH] perf: annotate: make it respect -i option.
  2015-04-02  6:04 [PATCH] perf: annotate: make it respect -i option Wang Nan
@ 2015-04-02  8:12 ` Namhyung Kim
  2015-04-21  3:06   ` Wang Nan
  2015-04-02  8:24 ` [PATCH] perf kmem: Respect " Jiri Olsa
  1 sibling, 1 reply; 4+ messages in thread
From: Namhyung Kim @ 2015-04-02  8:12 UTC (permalink / raw)
  To: Wang Nan; +Cc: acme, jolsa, mingo, lizefan, pi3orama, linux-kernel

On Thu, Apr 02, 2015 at 06:04:52AM +0000, Wang Nan wrote:
> There is a bug in perf annotate that it doesn't respect user provided
> '-i'/'--input' option:
> 
>  # perf record ls
>    [ perf record: Woken up 1 times to write data ]
>    [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
>  # mv ./perf.data ./perf.data.new
>  # perf annotate -i ./perf.data.new  --stdio
>    failed to open perf.data: No such file or directory  (try 'perf record' first)
> 
> This patch fix it by setting file path after option parsing, like
> what 'perf report' does.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>

I guess other commands are also suffered from this bug.. anyway,

Acked-by: Namhyung Kim <namhyung@kernel.org>

Thanks,
Namhyung

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

* [PATCH] perf kmem: Respect -i option
  2015-04-02  6:04 [PATCH] perf: annotate: make it respect -i option Wang Nan
  2015-04-02  8:12 ` Namhyung Kim
@ 2015-04-02  8:24 ` Jiri Olsa
  1 sibling, 0 replies; 4+ messages in thread
From: Jiri Olsa @ 2015-04-02  8:24 UTC (permalink / raw)
  To: Wang Nan; +Cc: acme, jolsa, namhyung, mingo, lizefan, pi3orama, linux-kernel

On Thu, Apr 02, 2015 at 06:04:52AM +0000, Wang Nan wrote:
> There is a bug in perf annotate that it doesn't respect user provided
> '-i'/'--input' option:
> 
>  # perf record ls
>    [ perf record: Woken up 1 times to write data ]
>    [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
>  # mv ./perf.data ./perf.data.new
>  # perf annotate -i ./perf.data.new  --stdio
>    failed to open perf.data: No such file or directory  (try 'perf record' first)
> 
> This patch fix it by setting file path after option parsing, like
> what 'perf report' does.
> 
> Signed-off-by: Wang Nan <wangnan0@huawei.com>

Acked-by: Jiri Olsa <jolsa@kernel.org>

plus found another in kmem.. ;-)

thanks,
jirka


---
Currently the perf kmem does not respect -i option.
Initializing the file.path properly after options
get parsed.

Signed-off-by: Jiri Olsa <jolsa@kernel.org>
---
 tools/perf/builtin-kmem.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 64d3623d45a0..c81e24870e7b 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -684,7 +684,6 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
 	};
 	struct perf_session *session;
 	struct perf_data_file file = {
-		.path = input_name,
 		.mode = PERF_DATA_MODE_READ,
 	};
 	int ret = -1;
@@ -700,6 +699,8 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
 		return __cmd_record(argc, argv);
 	}
 
+	file.path = input_name;
+
 	session = perf_session__new(&file, false, &perf_kmem);
 	if (session == NULL)
 		return -1;
-- 
1.9.3


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

* Re: [PATCH] perf: annotate: make it respect -i option.
  2015-04-02  8:12 ` Namhyung Kim
@ 2015-04-21  3:06   ` Wang Nan
  0 siblings, 0 replies; 4+ messages in thread
From: Wang Nan @ 2015-04-21  3:06 UTC (permalink / raw)
  To: Namhyung Kim; +Cc: acme, jolsa, mingo, lizefan, pi3orama, linux-kernel

On 2015/4/2 16:12, Namhyung Kim wrote:
> On Thu, Apr 02, 2015 at 06:04:52AM +0000, Wang Nan wrote:
>> There is a bug in perf annotate that it doesn't respect user provided
>> '-i'/'--input' option:
>>
>>  # perf record ls
>>    [ perf record: Woken up 1 times to write data ]
>>    [ perf record: Captured and wrote 0.001 MB perf.data (8 samples) ]
>>  # mv ./perf.data ./perf.data.new
>>  # perf annotate -i ./perf.data.new  --stdio
>>    failed to open perf.data: No such file or directory  (try 'perf record' first)
>>
>> This patch fix it by setting file path after option parsing, like
>> what 'perf report' does.
>>
>> Signed-off-by: Wang Nan <wangnan0@huawei.com>
> 
> I guess other commands are also suffered from this bug.. anyway,
> 
> Acked-by: Namhyung Kim <namhyung@kernel.org>
> 
> Thanks,
> Namhyung
> 

Hi,

Looks like the next patch 'perf kmem: Respect -i option' has already been collected
by tip/master, but this patch is lost. Is there any problem?

Thank you!



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

end of thread, other threads:[~2015-04-21  3:11 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-04-02  6:04 [PATCH] perf: annotate: make it respect -i option Wang Nan
2015-04-02  8:12 ` Namhyung Kim
2015-04-21  3:06   ` Wang Nan
2015-04-02  8:24 ` [PATCH] perf kmem: Respect " Jiri Olsa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).