From: "Liang, Kan" <kan.liang@linux.intel.com>
To: Jiri Olsa <jolsa@redhat.com>
Cc: acme@kernel.org, peterz@infradead.org, mingo@redhat.com,
linux-kernel@vger.kernel.org, namhyung@kernel.org,
adrian.hunter@intel.com, mathieu.poirier@linaro.org,
ravi.bangoria@linux.ibm.com, alexey.budankov@linux.intel.com,
vitaly.slobodskoy@intel.com, pavel.gerasimov@intel.com,
mpe@ellerman.id.au, eranian@google.com, ak@linux.intel.com
Subject: Re: [PATCH V3 15/17] perf top: Add option to enable the LBR stitching approach
Date: Wed, 18 Mar 2020 10:19:28 -0400 [thread overview]
Message-ID: <c714171d-3ead-39a9-fcc8-ab21fc79271f@linux.intel.com> (raw)
In-Reply-To: <20200318121405.GA849721@krava>
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
next prev parent reply other threads:[~2020-03-18 14:19 UTC|newest]
Thread overview: 26+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-13 18:33 [PATCH V3 00/17] Stitch LBR call stack (Perf Tools) kan.liang
2020-03-13 18:33 ` [PATCH V3 01/17] perf pmu: Add support for PMU capabilities kan.liang
2020-03-18 19:47 ` Arnaldo Carvalho de Melo
2020-03-19 13:07 ` Liang, Kan
2020-03-13 18:33 ` [PATCH V3 02/17] perf header: Support CPU " kan.liang
2020-03-18 19:49 ` Arnaldo Carvalho de Melo
2020-03-13 18:33 ` [PATCH V3 03/17] perf record: Clear HEADER_CPU_PMU_CAPS for non LBR call stack mode kan.liang
2020-03-13 18:33 ` [PATCH V3 04/17] perf stat: Clear HEADER_CPU_PMU_CAPS kan.liang
2020-03-13 18:33 ` [PATCH V3 05/17] perf machine: Remove the indent in resolve_lbr_callchain_sample kan.liang
2020-03-18 19:50 ` Arnaldo Carvalho de Melo
2020-03-13 18:33 ` [PATCH V3 06/17] perf machine: Refine the function for LBR call stack reconstruction kan.liang
2020-03-13 18:33 ` [PATCH V3 07/17] perf machine: Factor out lbr_callchain_add_kernel_ip() kan.liang
2020-03-13 18:33 ` [PATCH V3 08/17] perf machine: Factor out lbr_callchain_add_lbr_ip() kan.liang
2020-03-13 18:33 ` [PATCH V3 09/17] perf thread: Add a knob for LBR stitch approach kan.liang
2020-03-13 18:33 ` [PATCH V3 10/17] perf tools: Save previous sample for LBR stitching approach kan.liang
2020-03-18 12:14 ` Jiri Olsa
2020-03-18 14:20 ` Liang, Kan
2020-03-13 18:33 ` [PATCH V3 11/17] perf tools: Save previous cursor nodes " kan.liang
2020-03-13 18:33 ` [PATCH V3 12/17] perf tools: Stitch LBR call stack kan.liang
2020-03-13 18:33 ` [PATCH V3 13/17] perf report: Add option to enable the LBR stitching approach kan.liang
2020-03-13 18:33 ` [PATCH V3 14/17] perf script: " kan.liang
2020-03-13 18:33 ` [PATCH V3 15/17] perf top: " kan.liang
2020-03-18 12:14 ` Jiri Olsa
2020-03-18 14:19 ` Liang, Kan [this message]
2020-03-13 18:33 ` [PATCH V3 16/17] perf c2c: " kan.liang
2020-03-13 18:33 ` [PATCH V3 17/17] perf hist: Add fast path for duplicate entries check kan.liang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=c714171d-3ead-39a9-fcc8-ab21fc79271f@linux.intel.com \
--to=kan.liang@linux.intel.com \
--cc=acme@kernel.org \
--cc=adrian.hunter@intel.com \
--cc=ak@linux.intel.com \
--cc=alexey.budankov@linux.intel.com \
--cc=eranian@google.com \
--cc=jolsa@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.poirier@linaro.org \
--cc=mingo@redhat.com \
--cc=mpe@ellerman.id.au \
--cc=namhyung@kernel.org \
--cc=pavel.gerasimov@intel.com \
--cc=peterz@infradead.org \
--cc=ravi.bangoria@linux.ibm.com \
--cc=vitaly.slobodskoy@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).