summaryrefslogtreecommitdiff
path: root/tools/perf
diff options
context:
space:
mode:
authorMathieu Poirier <mathieu.poirier@linaro.org>2019-02-12 20:16:18 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2019-02-14 21:18:08 +0300
commit8224531cf5a1246bbe1d43c5db26e5348aeb77c5 (patch)
treec8fc3d2f290a76146c0926aa8ea1aa2fe13b315e /tools/perf
parent3fa0e83e29488547b39f321fd5a239f08f129c72 (diff)
downloadlinux-8224531cf5a1246bbe1d43c5db26e5348aeb77c5.tar.xz
perf cs-etm: Modularize auxtrace_buffer fetch function
Making the auxtrace_buffer fetch function modular so that it can be called from different decoding context (timeless vs. non-timeless), avoiding to repeat code. No change in functionality is introduced by this patch. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org> Cc: Jiri Olsa <jolsa@redhat.com> Cc: Leo Yan <leo.yan@linaro.org> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Suzuki K Poulouse <suzuki.poulose@arm.com> Cc: linux-arm-kernel@lists.infradead.org Link: http://lkml.kernel.org/r/20190212171618.25355-14-mathieu.poirier@linaro.org Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/cs-etm.c41
1 files changed, 29 insertions, 12 deletions
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index f607bc58bd03..110804936fc3 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1152,6 +1152,32 @@ static int cs_etm__end_block(struct cs_etm_queue *etmq)
return 0;
}
+/*
+ * cs_etm__get_data_block: Fetch a block from the auxtrace_buffer queue
+ * if need be.
+ * Returns: < 0 if error
+ * = 0 if no more auxtrace_buffer to read
+ * > 0 if the current buffer isn't empty yet
+ */
+static int cs_etm__get_data_block(struct cs_etm_queue *etmq)
+{
+ int ret;
+
+ if (!etmq->buf_len) {
+ ret = cs_etm__get_trace(etmq);
+ if (ret <= 0)
+ return ret;
+ /*
+ * We cannot assume consecutive blocks in the data file
+ * are contiguous, reset the decoder to force re-sync.
+ */
+ ret = cs_etm_decoder__reset(etmq->decoder);
+ if (ret)
+ return ret;
+ }
+
+ return etmq->buf_len;
+}
static bool cs_etm__is_svc_instr(struct cs_etm_queue *etmq,
struct cs_etm_packet *packet,
@@ -1591,18 +1617,9 @@ static int cs_etm__run_decoder(struct cs_etm_queue *etmq)
/* Go through each buffer in the queue and decode them one by one */
while (1) {
- if (!etmq->buf_len) {
- err = cs_etm__get_trace(etmq);
- if (err <= 0)
- return err;
- /*
- * We cannot assume consecutive blocks in the data file
- * are contiguous, reset the decoder to force re-sync.
- */
- err = cs_etm_decoder__reset(etmq->decoder);
- if (err != 0)
- return err;
- }
+ err = cs_etm__get_data_block(etmq);
+ if (err <= 0)
+ return err;
/* Run trace decoder until buffer consumed or end of trace */
do {