[PATCH 5/5] perf tools: Add report.show-headers config file option

From: Jiri Olsa
Date: Thu Jun 19 2014 - 07:41:47 EST


Adding report.show-headers config file option to setup
the appearance of the columns headers.

Currently columns headers are displayed by default, following
lines in ~/.perfconfig file will disable that:

[report]
show-headers = true

Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>
Cc: Corey Ashford <cjashfor@xxxxxxxxxxxxxxxxxx>
Cc: David Ahern <dsahern@xxxxxxxxx>
Cc: Frederic Weisbecker <fweisbec@xxxxxxxxx>
Cc: Ingo Molnar <mingo@xxxxxxxxxx>
Cc: Namhyung Kim <namhyung@xxxxxxxxxx>
Cc: Paul Mackerras <paulus@xxxxxxxxx>
Cc: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
Signed-off-by: Jiri Olsa <jolsa@xxxxxxxxxx>
---
tools/perf/builtin-report.c | 4 ++++
tools/perf/ui/browsers/hists.c | 6 +++++-
tools/perf/util/symbol.c | 1 +
tools/perf/util/symbol.h | 1 +
4 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index 21d830b..cbc68c6 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -76,6 +76,10 @@ static int report__config(const char *var, const char *value, void *cb)
symbol_conf.cumulate_callchain = perf_config_bool(var, value);
return 0;
}
+ if (!strcmp(var, "report.show-headers")) {
+ symbol_conf.show_headers = perf_config_bool(var, value);
+ return 0;
+ }

return perf_default_config(var, value, cb);
}
diff --git a/tools/perf/ui/browsers/hists.c b/tools/perf/ui/browsers/hists.c
index b923f61..a878284 100644
--- a/tools/perf/ui/browsers/hists.c
+++ b/tools/perf/ui/browsers/hists.c
@@ -1260,11 +1260,15 @@ static struct hist_browser *hist_browser__new(struct hists *hists)
struct hist_browser *browser = zalloc(sizeof(*browser));

if (browser) {
+ /* If no config option is set, keep the default 'true'. */
+ bool show_headers = symbol_conf.show_headers == -1 ?
+ true : symbol_conf.show_headers;
+
browser->hists = hists;
browser->b.ops.refresh = hist_browser__refresh;
browser->b.ops.seek = ui_browser__hists_seek;
browser->b.use_navkeypressed = true;
- browser->show_headers = true;
+ browser->show_headers = show_headers;
}

return browser;
diff --git a/tools/perf/util/symbol.c b/tools/perf/util/symbol.c
index 7b9096f..45a319b 100644
--- a/tools/perf/util/symbol.c
+++ b/tools/perf/util/symbol.c
@@ -35,6 +35,7 @@ struct symbol_conf symbol_conf = {
.demangle = true,
.cumulate_callchain = true,
.symfs = "",
+ .show_headers = -1,
};

static enum dso_binary_type binary_type_symtab[] = {
diff --git a/tools/perf/util/symbol.h b/tools/perf/util/symbol.h
index 615c752..8f1854a 100644
--- a/tools/perf/util/symbol.h
+++ b/tools/perf/util/symbol.h
@@ -139,6 +139,7 @@ struct symbol_conf {
*sym_from_list,
*sym_to_list;
const char *symfs;
+ int show_headers;
};

extern struct symbol_conf symbol_conf;
--
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/