aboutsummaryrefslogtreecommitdiff
path: root/tools/perf/builtin-report.c
diff options
context:
space:
mode:
authorFeng Tang <feng.tang@intel.com>2012-10-30 11:56:02 +0800
committerArnaldo Carvalho de Melo <acme@redhat.com>2012-10-29 11:45:34 -0200
commit70cb4e963f77dae90ae2aa3dd9385a43737c469f (patch)
tree41b94acf8d0f01e93f6c214b9ee1bdae11b41538 /tools/perf/builtin-report.c
parentcdd059d731eeb466f51a404ee6cbfafb0fc7c20b (diff)
perf tools: Add a global variable "const char *input_name"
Currently many perf commands annotate/evlist/report/script/lock etc all support "-i" option to chose a specific perf data, and all of them create a local "input_name" to save the file name for that perf data. Since most of these commands need it, we can add a global variable for it, also it can some other benefits: 1. When calling script browser inside hists/annotation browser, it needs to know the perf data file name to run that script. 2. For further feature like runtime switching to another perf data file, this variable can also help. Signed-off-by: Feng Tang <feng.tang@intel.com> Cc: Andi Kleen <andi@firstfloor.org> Cc: Ingo Molnar <mingo@elte.hu> Cc: Namhyung Kim <namhyung@kernel.org> Cc: Peter Zijlstra <peterz@infradead.org> Link: http://lkml.kernel.org/r/1351569369-26732-2-git-send-email-feng.tang@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/builtin-report.c')
-rw-r--r--tools/perf/builtin-report.c13
1 files changed, 6 insertions, 7 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 90d1162bb8b..f07eae73e69 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -40,7 +40,6 @@
struct perf_report {
struct perf_tool tool;
struct perf_session *session;
- char const *input_name;
bool force, use_tui, use_gtk, use_stdio;
bool hide_unresolved;
bool dont_use_callchains;
@@ -571,7 +570,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
.pretty_printing_style = "normal",
};
const struct option options[] = {
- OPT_STRING('i', "input", &report.input_name, "file",
+ OPT_STRING('i', "input", &input_name, "file",
"input file name"),
OPT_INCR('v', "verbose", &verbose,
"be more verbose (show symbol address, etc)"),
@@ -657,13 +656,13 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
if (report.inverted_callchain)
callchain_param.order = ORDER_CALLER;
- if (!report.input_name || !strlen(report.input_name)) {
+ if (!input_name || !strlen(input_name)) {
if (!fstat(STDIN_FILENO, &st) && S_ISFIFO(st.st_mode))
- report.input_name = "-";
+ input_name = "-";
else
- report.input_name = "perf.data";
+ input_name = "perf.data";
}
- session = perf_session__new(report.input_name, O_RDONLY,
+ session = perf_session__new(input_name, O_RDONLY,
report.force, false, &report.tool);
if (session == NULL)
return -ENOMEM;
@@ -694,7 +693,7 @@ int cmd_report(int argc, const char **argv, const char *prefix __maybe_unused)
}
- if (strcmp(report.input_name, "-") != 0)
+ if (strcmp(input_name, "-") != 0)
setup_browser(true);
else {
use_browser = 0;