On Fri, Jun 01, 2018 at 05:58:35PM +0800, Leo Yan wrote:
If one CS_ETM_TRACE_ON packet is inserted, we miss to generate branch sample for the previous CS_ETM_RANGE packet.
This patch is to generate branch sample when receiving a CS_ETM_TRACE_ON packet, so this can save complete info for the previous CS_ETM_RANGE packet just before CS_ETM_TRACE_ON packet.
Another minor fixing is to directly return error code for the instruction sample failure.
As a rule of thumb when you need to write the work "also" in a changelog, it means the patch needs to be split.
Signed-off-by: Leo Yan leo.yan@linaro.org
tools/perf/util/cs-etm.c | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index bf34960..beff486 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -935,6 +935,7 @@ static int cs_etm__sample(struct cs_etm_queue *etmq) static int cs_etm__flush(struct cs_etm_queue *etmq) { int err = 0;
- struct cs_etm_auxtrace *etm = etmq->etm; struct cs_etm_packet *tmp;
if (!etmq->prev_packet) @@ -961,12 +962,20 @@ static int cs_etm__flush(struct cs_etm_queue *etmq) err = cs_etm__synth_instruction_sample( etmq, addr, etmq->period_instructions);
if (err)
return err;
This needs to be on a patch of its own.
etmq->period_instructions = 0;
}
- if (etm->sample_branches) {
err = cs_etm__synth_branch_sample(etmq);
if (err)
return err;
- }
This...
swap_packet:
- if (etmq->etm->synth_opts.last_branch) {
- if (etm->sample_branches || etm->synth_opts.last_branch) {
... and this go in the same patch, but separate from the above.
The two patches created here along with the first patch in this set can be sent to the mailing list as bug fixes.
Also note there is no point to do that until 4.18-rc1 gets released in a couple of weeks. Otherwise Arnaldo will completely ignore your patches.
/* * Swap PACKET with PREV_PACKET: PACKET becomes PREV_PACKET for * the next incoming packet.
-- 2.7.4