lkml.org 
[lkml]   [2020]   [Mar]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
SubjectRe: [PATCH V3 15/17] perf top: Add option to enable the LBR stitching approach
From
Date


On 3/18/2020 8:14 AM, Jiri Olsa wrote:
> On Fri, Mar 13, 2020 at 11:33:17AM -0700, kan.liang@linux.intel.com wrote:
>
> SNIP
>
>> #include "util/top.h"
>> @@ -766,6 +767,9 @@ static void perf_event__process_sample(struct perf_tool *tool,
>> if (machine__resolve(machine, &al, sample) < 0)
>> return;
>>
>> + if (top->stitch_lbr)
>> + al.thread->lbr_stitch_enable = true;
>> +
>> if (!machine->kptr_restrict_warned &&
>> symbol_conf.kptr_restrict &&
>> al.cpumode == PERF_RECORD_MISC_KERNEL) {
>> @@ -1543,6 +1547,8 @@ int cmd_top(int argc, const char **argv)
>> "number of thread to run event synthesize"),
>> OPT_BOOLEAN(0, "namespaces", &opts->record_namespaces,
>> "Record namespaces events"),
>> + OPT_BOOLEAN(0, "stitch-lbr", &top.stitch_lbr,
>> + "Enable LBR callgraph stitching approach"),
>> OPTS_EVSWITCH(&top.evswitch),
>> OPT_END()
>> };
>> @@ -1612,6 +1618,11 @@ int cmd_top(int argc, const char **argv)
>> }
>> }
>>
>> + if (top.stitch_lbr && !(callchain_param.record_mode == CALLCHAIN_LBR)) {
>> + pr_err("Error: --stitch-lbr must be used with --call-graph lbr\n");
>> + goto out_delete_evlist;
>> + }
>
> why is this check not added for script/report/c2c..?
>

You are right. We should add a check for other tools as well.
I will print a warning as below for other tools in V3.

diff --git a/tools/perf/builtin-c2c.c b/tools/perf/builtin-c2c.c
index c798763f62db..0d544c4fb4be 100644
--- a/tools/perf/builtin-c2c.c
+++ b/tools/perf/builtin-c2c.c
@@ -2605,6 +2605,12 @@ static int setup_callchain(struct evlist *evlist)
}
}

+ if (c2c.stitch_lbr && (mode != CALLCHAIN_LBR)) {
+ ui__warning("Can't find LBR callchain. Switch off --stitch-lbr.\n"
+ "Please apply --call-graph lbr when recording.\n");
+ c2c.stitch_lbr = false;
+ }
+
callchain_param.record_mode = mode;
callchain_param.min_percent = 0;
return 0;
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c
index e41cedb9256c..3bdbd3649be7 100644
--- a/tools/perf/builtin-report.c
+++ b/tools/perf/builtin-report.c
@@ -411,6 +411,12 @@ static int report__setup_sample_type(struct report
*rep)
callchain_param.record_mode = CALLCHAIN_FP;
}

+ if (rep->stitch_lbr && (callchain_param.record_mode != CALLCHAIN_LBR)) {
+ ui__warning("Can't find LBR callchain. Switch off --stitch-lbr.\n"
+ "Please apply --call-graph lbr when recording.\n");
+ rep->stitch_lbr = false;
+ }
+
/* ??? handle more cases than just ANY? */
if (!(perf_evlist__combined_branch_type(session->evlist) &
PERF_SAMPLE_BRANCH_ANY))
diff --git a/tools/perf/builtin-script.c b/tools/perf/builtin-script.c
index f8f50bf95e40..e0ec4a0e7b35 100644
--- a/tools/perf/builtin-script.c
+++ b/tools/perf/builtin-script.c
@@ -3299,6 +3299,12 @@ static void script__setup_sample_type(struct
perf_script *script)
else
callchain_param.record_mode = CALLCHAIN_FP;
}
+
+ if (script->stitch_lbr && (callchain_param.record_mode !=
CALLCHAIN_LBR)) {
+ pr_warning("Can't find LBR callchain. Switch off --stitch-lbr.\n"
+ "Please apply --call-graph lbr when recording.\n");
+ script->stitch_lbr = false;
+ }
}

static int process_stat_round_event(struct perf_session *session,
Thanks,
Kan

\
 
 \ /
  Last update: 2020-03-18 15:21    [W:0.039 / U:0.136 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site