Hi Mathieu,
On Sun, Jun 10, 2018 at 04:19:05PM +0800, Leo Yan wrote:
CS_ETM_TRACE_ON packet itself can give the info that there have a discontinuity in the trace, this patch is to add branch sample for CS_ETM_TRACE_ON packet if it is inserted in the middle of CS_ETM_RANGE packets; as result we can have hint for the trace discontinuity.
I followed your suggestion to prepare the cs-etm fixing patch series (if I didn't miss anything), but I am struggling to add this patch into the fixing patch series or not, though I understand I should keep the patch series as simple as possible for easier reviewing and merging.
Seems to me, the patch 5/6 'perf cs-etm: Generate branch sample when receiving a CS_ETM_TRACE_ON packet' has inserted partial info of CS_ETM_TRACE_ON for samples, e.g. the CS_ETM_TRACE_ON packet::addr has been used to generate branch sample, if without this patch we will miss the branch sample for CS_ETM_TRACE_ON::ip. So I decided to add this patch into fixing series. So my main reason for adding patch 6/6 is to make the fixing to be more complete.
Please let me know if you agree with this? Or have other suggestion. Thanks in advance.
Signed-off-by: Leo Yan leo.yan@linaro.org
tools/perf/util/cs-etm.c | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index d3b7942..2ae6402 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -910,13 +910,23 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) etmq->period_instructions = instrs_over; }
- if (etm->sample_branches &&
etmq->prev_packet &&
etmq->prev_packet->sample_type == CS_ETM_RANGE &&
etmq->prev_packet->last_instr_taken_branch) {
ret = cs_etm__synth_branch_sample(etmq);
if (ret)
return ret;
- if (etm->sample_branches && etmq->prev_packet) {
bool generate_sample = false;
/* Generate sample for tracing on packet */
if (etmq->prev_packet->sample_type == CS_ETM_TRACE_ON)
generate_sample = true;
/* Generate sample for branch taken packet */
if (etmq->prev_packet->sample_type == CS_ETM_RANGE &&
etmq->prev_packet->last_instr_taken_branch)
generate_sample = true;
if (generate_sample) {
ret = cs_etm__synth_branch_sample(etmq);
if (ret)
return ret;
}}
if (etm->sample_branches || etm->synth_opts.last_branch) { -- 2.7.4