|
@@ -917,15 +917,15 @@ out_err:
|
|
|
return -1;
|
|
|
}
|
|
|
|
|
|
-static int perf_top__setup_sample_type(struct perf_top *top __maybe_unused)
|
|
|
+static int callchain_param__setup_sample_type(struct callchain_param *callchain)
|
|
|
{
|
|
|
if (!sort__has_sym) {
|
|
|
- if (symbol_conf.use_callchain) {
|
|
|
+ if (callchain->enabled) {
|
|
|
ui__error("Selected -g but \"sym\" not present in --sort/-s.");
|
|
|
return -EINVAL;
|
|
|
}
|
|
|
- } else if (callchain_param.mode != CHAIN_NONE) {
|
|
|
- if (callchain_register_param(&callchain_param) < 0) {
|
|
|
+ } else if (callchain->mode != CHAIN_NONE) {
|
|
|
+ if (callchain_register_param(callchain) < 0) {
|
|
|
ui__error("Can't register callchain params.\n");
|
|
|
return -EINVAL;
|
|
|
}
|
|
@@ -952,7 +952,7 @@ static int __cmd_top(struct perf_top *top)
|
|
|
goto out_delete;
|
|
|
}
|
|
|
|
|
|
- ret = perf_top__setup_sample_type(top);
|
|
|
+ ret = callchain_param__setup_sample_type(&callchain_param);
|
|
|
if (ret)
|
|
|
goto out_delete;
|
|
|
|
|
@@ -1045,18 +1045,17 @@ callchain_opt(const struct option *opt, const char *arg, int unset)
|
|
|
static int
|
|
|
parse_callchain_opt(const struct option *opt, const char *arg, int unset)
|
|
|
{
|
|
|
- struct record_opts *record = (struct record_opts *)opt->value;
|
|
|
+ struct callchain_param *callchain = opt->value;
|
|
|
|
|
|
- record->callgraph_set = true;
|
|
|
- callchain_param.enabled = !unset;
|
|
|
- callchain_param.record_mode = CALLCHAIN_FP;
|
|
|
+ callchain->enabled = !unset;
|
|
|
+ callchain->record_mode = CALLCHAIN_FP;
|
|
|
|
|
|
/*
|
|
|
* --no-call-graph
|
|
|
*/
|
|
|
if (unset) {
|
|
|
symbol_conf.use_callchain = false;
|
|
|
- callchain_param.record_mode = CALLCHAIN_NONE;
|
|
|
+ callchain->record_mode = CALLCHAIN_NONE;
|
|
|
return 0;
|
|
|
}
|
|
|
|
|
@@ -1162,10 +1161,10 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
|
|
|
"output field(s): overhead, period, sample plus all of sort keys"),
|
|
|
OPT_BOOLEAN('n', "show-nr-samples", &symbol_conf.show_nr_samples,
|
|
|
"Show a column with the number of samples"),
|
|
|
- OPT_CALLBACK_NOOPT('g', NULL, &top.record_opts,
|
|
|
+ OPT_CALLBACK_NOOPT('g', NULL, &callchain_param,
|
|
|
NULL, "enables call-graph recording and display",
|
|
|
&callchain_opt),
|
|
|
- OPT_CALLBACK(0, "call-graph", &top.record_opts,
|
|
|
+ OPT_CALLBACK(0, "call-graph", &callchain_param,
|
|
|
"record_mode[,record_size],print_type,threshold[,print_limit],order,sort_key[,branch]",
|
|
|
top_callchain_help, &parse_callchain_opt),
|
|
|
OPT_BOOLEAN(0, "children", &symbol_conf.cumulate_callchain,
|
|
@@ -1312,7 +1311,7 @@ int cmd_top(int argc, const char **argv, const char *prefix __maybe_unused)
|
|
|
|
|
|
top.sym_evsel = perf_evlist__first(top.evlist);
|
|
|
|
|
|
- if (!symbol_conf.use_callchain) {
|
|
|
+ if (!callchain_param.enabled) {
|
|
|
symbol_conf.cumulate_callchain = false;
|
|
|
perf_hpp__cancel_cumulate();
|
|
|
}
|