Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753076AbbDBIYc (ORCPT ); Thu, 2 Apr 2015 04:24:32 -0400 Received: from mx1.redhat.com ([209.132.183.28]:58886 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752514AbbDBIY2 (ORCPT ); Thu, 2 Apr 2015 04:24:28 -0400 Date: Thu, 2 Apr 2015 10:24:24 +0200 From: Jiri Olsa To: Wang Nan Cc: acme@kernel.org, jolsa@kernel.org, namhyung@kernel.org, mingo@redhat.com, lizefan@huawei.com, pi3orama@163.com, linux-kernel@vger.kernel.org Subject: [PATCH] perf kmem: Respect -i option Message-ID: <20150402082424.GA1305@krava> References: <1427954692-105642-1-git-send-email-wangnan0@huawei.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1427954692-105642-1-git-send-email-wangnan0@huawei.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1892 Lines: 63 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 Acked-by: Jiri Olsa 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 --- 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 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/