diff options
author | Feng Tang <feng.tang@intel.com> | 2012-10-29 23:56:02 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2012-10-29 09:45:34 -0400 |
commit | 70cb4e963f77dae90ae2aa3dd9385a43737c469f (patch) | |
tree | 41b94acf8d0f01e93f6c214b9ee1bdae11b41538 /tools/perf/builtin-sched.c | |
parent | cdd059d731eeb466f51a404ee6cbfafb0fc7c20b (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-sched.c')
-rw-r--r-- | tools/perf/builtin-sched.c | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 30e53360d3c2..cc28b85dabd5 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c | |||
@@ -120,7 +120,6 @@ struct trace_sched_handler { | |||
120 | 120 | ||
121 | struct perf_sched { | 121 | struct perf_sched { |
122 | struct perf_tool tool; | 122 | struct perf_tool tool; |
123 | const char *input_name; | ||
124 | const char *sort_order; | 123 | const char *sort_order; |
125 | unsigned long nr_tasks; | 124 | unsigned long nr_tasks; |
126 | struct task_desc *pid_to_task[MAX_PID]; | 125 | struct task_desc *pid_to_task[MAX_PID]; |
@@ -1460,7 +1459,7 @@ static int perf_sched__read_events(struct perf_sched *sched, bool destroy, | |||
1460 | }; | 1459 | }; |
1461 | struct perf_session *session; | 1460 | struct perf_session *session; |
1462 | 1461 | ||
1463 | session = perf_session__new(sched->input_name, O_RDONLY, 0, false, &sched->tool); | 1462 | session = perf_session__new(input_name, O_RDONLY, 0, false, &sched->tool); |
1464 | if (session == NULL) { | 1463 | if (session == NULL) { |
1465 | pr_debug("No Memory for session\n"); | 1464 | pr_debug("No Memory for session\n"); |
1466 | return -1; | 1465 | return -1; |
@@ -1708,7 +1707,7 @@ int cmd_sched(int argc, const char **argv, const char *prefix __maybe_unused) | |||
1708 | OPT_END() | 1707 | OPT_END() |
1709 | }; | 1708 | }; |
1710 | const struct option sched_options[] = { | 1709 | const struct option sched_options[] = { |
1711 | OPT_STRING('i', "input", &sched.input_name, "file", | 1710 | OPT_STRING('i', "input", &input_name, "file", |
1712 | "input file name"), | 1711 | "input file name"), |
1713 | OPT_INCR('v', "verbose", &verbose, | 1712 | OPT_INCR('v', "verbose", &verbose, |
1714 | "be more verbose (show symbol address, etc)"), | 1713 | "be more verbose (show symbol address, etc)"), |