* [PATCH v2] perf report: Fix debug messages with --call-graph option
@ 2017-09-23 8:18 Mengting Zhang
2017-09-25 13:02 ` Jiri Olsa
2017-09-29 20:05 ` [tip:perf/urgent] " tip-bot for Mengting Zhang
0 siblings, 2 replies; 4+ messages in thread
From: Mengting Zhang @ 2017-09-23 8:18 UTC (permalink / raw)
To: linux-kernel, linux-perf-users
Cc: peterz, mingo, acme, alexander.shishkin, yao.jin, ak, jolsa,
namhyung, kjlx, milian.wolff, wangnan0, huawei.libin,
zhangmengting
With --call-graph option, perf report can display call chains using
type, min percent threshold, optional print limit and order. And the
default call-graph parameter is 'graph,0.5,caller,function,percent'.
Before this patch, 'perf report --call-graph' shows incorrect debug
messages as below:
[root@localhost perf]# ./perf report --call-graph
Invalid callchain mode: 0.5
Invalid callchain order: 0.5
Invalid callchain sort key: 0.5
Invalid callchain config key: 0.5
Invalid callchain mode: caller
Invalid callchain mode: function
Invalid callchain order: function
Invalid callchain mode: percent
Invalid callchain order: percent
Invalid callchain sort key: percent
That is because in function __parse_callchain_report_opt(),each field
of the call-graph parameter is passed to parse_callchain_{mode,order,
sort_key,value} in turn until it meets the matching value.
For example, the order field "caller" is passed to parse_callchain_mode()
firstly and obviously it doesn't match any mode field. Therefore
parse_callchain_mode() will shows the debug message "Invalid callchain
mode: caller", which could confuse users.
The patch fixes this issue by moving the warning out of the function
parse_callchain_{mode,order,sort_key,value}.
Signed-off-by: Mengting Zhang <zhangmengting@huawei.com>
---
tools/perf/util/callchain.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 510b513..be09d77 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -65,8 +65,6 @@ static int parse_callchain_mode(const char *value)
callchain_param.mode = CHAIN_FOLDED;
return 0;
}
-
- pr_err("Invalid callchain mode: %s\n", value);
return -1;
}
@@ -82,8 +80,6 @@ static int parse_callchain_order(const char *value)
callchain_param.order_set = true;
return 0;
}
-
- pr_err("Invalid callchain order: %s\n", value);
return -1;
}
@@ -105,8 +101,6 @@ static int parse_callchain_sort_key(const char *value)
callchain_param.branch_callstack = 1;
return 0;
}
-
- pr_err("Invalid callchain sort key: %s\n", value);
return -1;
}
@@ -124,8 +118,6 @@ static int parse_callchain_value(const char *value)
callchain_param.value = CCVAL_COUNT;
return 0;
}
-
- pr_err("Invalid callchain config key: %s\n", value);
return -1;
}
@@ -319,12 +311,27 @@ int perf_callchain_config(const char *var, const char *value)
return ret;
}
- if (!strcmp(var, "print-type"))
- return parse_callchain_mode(value);
- if (!strcmp(var, "order"))
- return parse_callchain_order(value);
- if (!strcmp(var, "sort-key"))
- return parse_callchain_sort_key(value);
+ if (!strcmp(var, "print-type")){
+ int ret;
+ ret = parse_callchain_mode(value);
+ if (ret == -1)
+ pr_err("Invalid callchain mode: %s\n", value);
+ return ret;
+ }
+ if (!strcmp(var, "order")){
+ int ret;
+ ret = parse_callchain_order(value);
+ if (ret == -1)
+ pr_err("Invalid callchain order: %s\n", value);
+ return ret;
+ }
+ if (!strcmp(var, "sort-key")){
+ int ret;
+ ret = parse_callchain_sort_key(value);
+ if (ret == -1)
+ pr_err("Invalid callchain sort key: %s\n", value);
+ return ret;
+ }
if (!strcmp(var, "threshold")) {
callchain_param.min_percent = strtod(value, &endptr);
if (value == endptr) {
--
1.7.12.4
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH v2] perf report: Fix debug messages with --call-graph option
2017-09-23 8:18 [PATCH v2] perf report: Fix debug messages with --call-graph option Mengting Zhang
@ 2017-09-25 13:02 ` Jiri Olsa
2017-09-25 13:47 ` Arnaldo Carvalho de Melo
2017-09-29 20:05 ` [tip:perf/urgent] " tip-bot for Mengting Zhang
1 sibling, 1 reply; 4+ messages in thread
From: Jiri Olsa @ 2017-09-25 13:02 UTC (permalink / raw)
To: Mengting Zhang
Cc: linux-kernel, linux-perf-users, peterz, mingo, acme,
alexander.shishkin, yao.jin, ak, jolsa, namhyung, kjlx,
milian.wolff, wangnan0, huawei.libin
On Sat, Sep 23, 2017 at 04:18:14PM +0800, Mengting Zhang wrote:
> With --call-graph option, perf report can display call chains using
> type, min percent threshold, optional print limit and order. And the
> default call-graph parameter is 'graph,0.5,caller,function,percent'.
>
> Before this patch, 'perf report --call-graph' shows incorrect debug
> messages as below:
> [root@localhost perf]# ./perf report --call-graph
> Invalid callchain mode: 0.5
> Invalid callchain order: 0.5
> Invalid callchain sort key: 0.5
> Invalid callchain config key: 0.5
> Invalid callchain mode: caller
> Invalid callchain mode: function
> Invalid callchain order: function
> Invalid callchain mode: percent
> Invalid callchain order: percent
> Invalid callchain sort key: percent
>
> That is because in function __parse_callchain_report_opt(),each field
> of the call-graph parameter is passed to parse_callchain_{mode,order,
> sort_key,value} in turn until it meets the matching value.
>
> For example, the order field "caller" is passed to parse_callchain_mode()
> firstly and obviously it doesn't match any mode field. Therefore
> parse_callchain_mode() will shows the debug message "Invalid callchain
> mode: caller", which could confuse users.
>
> The patch fixes this issue by moving the warning out of the function
> parse_callchain_{mode,order,sort_key,value}.
>
> Signed-off-by: Mengting Zhang <zhangmengting@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
thanks,
jirka
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH v2] perf report: Fix debug messages with --call-graph option
2017-09-25 13:02 ` Jiri Olsa
@ 2017-09-25 13:47 ` Arnaldo Carvalho de Melo
0 siblings, 0 replies; 4+ messages in thread
From: Arnaldo Carvalho de Melo @ 2017-09-25 13:47 UTC (permalink / raw)
To: Mengting Zhang
Cc: Jiri Olsa, linux-kernel, linux-perf-users, peterz, mingo,
alexander.shishkin, yao.jin, ak, jolsa, namhyung, kjlx,
milian.wolff, wangnan0, huawei.libin
Em Mon, Sep 25, 2017 at 03:02:51PM +0200, Jiri Olsa escreveu:
> On Sat, Sep 23, 2017 at 04:18:14PM +0800, Mengting Zhang wrote:
> > The patch fixes this issue by moving the warning out of the function
> > parse_callchain_{mode,order,sort_key,value}.
> >
> > Signed-off-by: Mengting Zhang <zhangmengting@huawei.com>
>
> Acked-by: Jiri Olsa <jolsa@kernel.org>
Thanks, tested and queued for perf/urgent.
- Arnaldo
^ permalink raw reply [flat|nested] 4+ messages in thread
* [tip:perf/urgent] perf report: Fix debug messages with --call-graph option
2017-09-23 8:18 [PATCH v2] perf report: Fix debug messages with --call-graph option Mengting Zhang
2017-09-25 13:02 ` Jiri Olsa
@ 2017-09-29 20:05 ` tip-bot for Mengting Zhang
1 sibling, 0 replies; 4+ messages in thread
From: tip-bot for Mengting Zhang @ 2017-09-29 20:05 UTC (permalink / raw)
To: linux-tip-commits
Cc: wangnan0, acme, zhangmengting, mingo, tglx, alexander.shishkin,
hpa, linux-kernel, peterz, huawei.libin, jolsa, kjlx, namhyung,
ak, milian.wolff, yao.jin
Commit-ID: 9789e7e93f2b892098d7684ac8131092aa617814
Gitweb: https://git.kernel.org/tip/9789e7e93f2b892098d7684ac8131092aa617814
Author: Mengting Zhang <zhangmengting@huawei.com>
AuthorDate: Sat, 23 Sep 2017 16:18:14 +0800
Committer: Arnaldo Carvalho de Melo <acme@redhat.com>
CommitDate: Mon, 25 Sep 2017 12:20:12 -0300
perf report: Fix debug messages with --call-graph option
With --call-graph option, perf report can display call chains using
type, min percent threshold, optional print limit and order. And the
default call-graph parameter is 'graph,0.5,caller,function,percent'.
Before this patch, 'perf report --call-graph' shows incorrect debug
messages as below:
# perf report --call-graph
Invalid callchain mode: 0.5
Invalid callchain order: 0.5
Invalid callchain sort key: 0.5
Invalid callchain config key: 0.5
Invalid callchain mode: caller
Invalid callchain mode: function
Invalid callchain order: function
Invalid callchain mode: percent
Invalid callchain order: percent
Invalid callchain sort key: percent
That is because in function __parse_callchain_report_opt(),each field of
the call-graph parameter is passed to parse_callchain_{mode,order,
sort_key,value} in turn until it meets the matching value.
For example, the order field "caller" is passed to
parse_callchain_mode() firstly and obviously it doesn't match any mode
field. Therefore parse_callchain_mode() will shows the debug message
"Invalid callchain mode: caller", which could confuse users.
The patch fixes this issue by moving the warning out of the function
parse_callchain_{mode,order,sort_key,value}.
Signed-off-by: Mengting Zhang <zhangmengting@huawei.com>
Acked-by: Jiri Olsa <jolsa@kernel.org>
Tested-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Andi Kleen <ak@linux.intel.com>
Cc: Krister Johansen <kjlx@templeofstupid.com>
Cc: Li Bin <huawei.libin@huawei.com>
Cc: Milian Wolff <milian.wolff@kdab.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Wang Nan <wangnan0@huawei.com>
Cc: Yao Jin <yao.jin@linux.intel.com>
Link: http://lkml.kernel.org/r/1506154694-39691-1-git-send-email-zhangmengting@huawei.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
---
tools/perf/util/callchain.c | 35 +++++++++++++++++++++--------------
1 file changed, 21 insertions(+), 14 deletions(-)
diff --git a/tools/perf/util/callchain.c b/tools/perf/util/callchain.c
index 510b513..be09d77 100644
--- a/tools/perf/util/callchain.c
+++ b/tools/perf/util/callchain.c
@@ -65,8 +65,6 @@ static int parse_callchain_mode(const char *value)
callchain_param.mode = CHAIN_FOLDED;
return 0;
}
-
- pr_err("Invalid callchain mode: %s\n", value);
return -1;
}
@@ -82,8 +80,6 @@ static int parse_callchain_order(const char *value)
callchain_param.order_set = true;
return 0;
}
-
- pr_err("Invalid callchain order: %s\n", value);
return -1;
}
@@ -105,8 +101,6 @@ static int parse_callchain_sort_key(const char *value)
callchain_param.branch_callstack = 1;
return 0;
}
-
- pr_err("Invalid callchain sort key: %s\n", value);
return -1;
}
@@ -124,8 +118,6 @@ static int parse_callchain_value(const char *value)
callchain_param.value = CCVAL_COUNT;
return 0;
}
-
- pr_err("Invalid callchain config key: %s\n", value);
return -1;
}
@@ -319,12 +311,27 @@ int perf_callchain_config(const char *var, const char *value)
return ret;
}
- if (!strcmp(var, "print-type"))
- return parse_callchain_mode(value);
- if (!strcmp(var, "order"))
- return parse_callchain_order(value);
- if (!strcmp(var, "sort-key"))
- return parse_callchain_sort_key(value);
+ if (!strcmp(var, "print-type")){
+ int ret;
+ ret = parse_callchain_mode(value);
+ if (ret == -1)
+ pr_err("Invalid callchain mode: %s\n", value);
+ return ret;
+ }
+ if (!strcmp(var, "order")){
+ int ret;
+ ret = parse_callchain_order(value);
+ if (ret == -1)
+ pr_err("Invalid callchain order: %s\n", value);
+ return ret;
+ }
+ if (!strcmp(var, "sort-key")){
+ int ret;
+ ret = parse_callchain_sort_key(value);
+ if (ret == -1)
+ pr_err("Invalid callchain sort key: %s\n", value);
+ return ret;
+ }
if (!strcmp(var, "threshold")) {
callchain_param.min_percent = strtod(value, &endptr);
if (value == endptr) {
^ permalink raw reply related [flat|nested] 4+ messages in thread
end of thread, other threads:[~2017-09-29 20:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-09-23 8:18 [PATCH v2] perf report: Fix debug messages with --call-graph option Mengting Zhang
2017-09-25 13:02 ` Jiri Olsa
2017-09-25 13:47 ` Arnaldo Carvalho de Melo
2017-09-29 20:05 ` [tip:perf/urgent] " tip-bot for Mengting Zhang
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).