mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-28 10:41:38 -04:00
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 <[email protected]>
Acked-by: Jiri Olsa <[email protected]>
Tested-by: Arnaldo Carvalho de Melo <[email protected]>
Cc: Alexander Shishkin <[email protected]>
Cc: Andi Kleen <[email protected]>
Cc: Krister Johansen <[email protected]>
Cc: Li Bin <[email protected]>
Cc: Milian Wolff <[email protected]>
Cc: Namhyung Kim <[email protected]>
Cc: Peter Zijlstra <[email protected]>
Cc: Wang Nan <[email protected]>
Cc: Yao Jin <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
This commit is contained in:
parent
f1e52f14a6
commit
9789e7e93f
1 changed files with 21 additions and 14 deletions
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Reference in a new issue