path: root/tools/perf/builtin-kmem.c
diff options
authorFeng Tang <>2012-10-30 11:56:02 +0800
committerArnaldo Carvalho de Melo <>2012-10-29 11:45:34 -0200
commit70cb4e963f77dae90ae2aa3dd9385a43737c469f (patch)
tree41b94acf8d0f01e93f6c214b9ee1bdae11b41538 /tools/perf/builtin-kmem.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 <> Cc: Andi Kleen <> Cc: Ingo Molnar <> Cc: Namhyung Kim <> Cc: Peter Zijlstra <> Link: Signed-off-by: Arnaldo Carvalho de Melo <>
Diffstat (limited to 'tools/perf/builtin-kmem.c')
1 files changed, 2 insertions, 3 deletions
diff --git a/tools/perf/builtin-kmem.c b/tools/perf/builtin-kmem.c
index 14bf82f63659..0b4b796167be 100644
--- a/tools/perf/builtin-kmem.c
+++ b/tools/perf/builtin-kmem.c
@@ -477,7 +477,7 @@ static void sort_result(void)
__sort_result(&root_caller_stat, &root_caller_sorted, &caller_sort);
-static int __cmd_kmem(const char *input_name)
+static int __cmd_kmem(void)
int err = -EINVAL;
struct perf_session *session;
@@ -743,7 +743,6 @@ static int __cmd_record(int argc, const char **argv)
int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
const char * const default_sort_order = "frag,hit,bytes";
- const char *input_name = NULL;
const struct option kmem_options[] = {
OPT_STRING('i', "input", &input_name, "file", "input file name"),
@@ -779,7 +778,7 @@ int cmd_kmem(int argc, const char **argv, const char *prefix __maybe_unused)
if (list_empty(&alloc_sort))
setup_sorting(&alloc_sort, default_sort_order);
- return __cmd_kmem(input_name);
+ return __cmd_kmem();
} else
usage_with_options(kmem_usage, kmem_options);