linux-perf-users.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Roland Grunberg <rgrunber@redhat.com>
To: linux-perf-users@vger.kernel.org
Cc: Roland Grunberg <rgrunber@redhat.com>,
	Peter Zijlstra <a.p.zijlstra@chello.nl>,
	Paul Mackerras <paulus@samba.org>, Ingo Molnar <mingo@redhat.com>,
	Arnaldo Carvalho de Melo <acme@kernel.org>,
	Sergio Durigan Junior <sergiodj@redhat.com>,
	linux-kernel@vger.kernel.org
Subject: [PATCH] perf annotate: Set the input file name after parsing options.
Date: Thu, 19 Mar 2015 13:26:09 -0400	[thread overview]
Message-ID: <1426785969-26345-1-git-send-email-rgrunber@redhat.com> (raw)

The input file name should be set after parse_options has been called if
the '-i' option is to have any effect.

Signed-off-by: Roland Grunberg <rgrunber@redhat.com>
---

Not registered to the referenced lists so feel free to CC.

The input file option for perf-annotate seems to be broken and will always
default to 'perf.data'. The perf_data_file path field is being set before
parse_options has initialized input_name.

Current Behaviour :
$ perf record -o datafile uname
Linux
[ perf record: Woken up 1 times to write data ]
[ perf record: Captured and wrote 0.007 MB datafile (~322 samples) ]
$ file datafile
datafile: data
$ perf annotate --stdio -i datafile
failed to open perf.data: No such file or directory  (try 'perf record' first)

Expected Behaviour :
The 'perf-annotate' call should run against the specified input file.

 tools/perf/builtin-annotate.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-annotate.c b/tools/perf/builtin-annotate.c
index 747f861..78489bc 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[] = {
@@ -333,6 +332,8 @@ int cmd_annotate(int argc, const char **argv, const char *prefix __maybe_unused)
 
 	argc = parse_options(argc, argv, options, annotate_usage, 0);
 
+	file.path = input_name;
+
 	if (annotate.use_stdio)
 		use_browser = 0;
 	else if (annotate.use_tui)
-- 
2.1.0

             reply	other threads:[~2015-03-19 17:26 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-03-19 17:26 Roland Grunberg [this message]
2015-03-23  0:36 ` [PATCH] perf annotate: Set the input file name after parsing options Namhyung Kim

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1426785969-26345-1-git-send-email-rgrunber@redhat.com \
    --to=rgrunber@redhat.com \
    --cc=a.p.zijlstra@chello.nl \
    --cc=acme@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=mingo@redhat.com \
    --cc=paulus@samba.org \
    --cc=sergiodj@redhat.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).