[PATCH 1/2] perf top: Fix top.call-graph works abnormal

From: Yisheng Xie
Date: Mon Mar 12 2018 - 07:36:09 EST


When try to add call-graph for top into .perfconfig file, like:

[top]
call-graph = fp

find it cannot work for perf_top_config() do not parse this option.

Fix it by call perf_default_config() when config top.call-graph.

Fixes: b8cbb349061e (perf config: Bring perf_default_config to the very beginning at main())
Signed-off-by: Yisheng Xie <xieyisheng1@xxxxxxxxxx>
---
tools/perf/builtin-top.c | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/tools/perf/builtin-top.c b/tools/perf/builtin-top.c
index 35ac016..fd6e238 100644
--- a/tools/perf/builtin-top.c
+++ b/tools/perf/builtin-top.c
@@ -1224,8 +1224,10 @@ static int __cmd_top(struct perf_top *top)

static int perf_top_config(const char *var, const char *value, void *cb __maybe_unused)
{
- if (!strcmp(var, "top.call-graph"))
- var = "call-graph.record-mode"; /* fall-through */
+ if (!strcmp(var, "top.call-graph")) {
+ var = "call-graph.record-mode";
+ return perf_default_config(var, value, cb);
+ }
if (!strcmp(var, "top.children")) {
symbol_conf.cumulate_callchain = perf_config_bool(var, value);
return 0;
--
1.7.12.4