[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-f74f349c211e3e62bc7fe35a132918c7f2c0fafb@git.kernel.org>
Date: Fri, 15 Feb 2019 01:45:55 -0800
From: tip-bot for Mathieu Poirier <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: acme@...hat.com, peterz@...radead.org, mingo@...nel.org,
jolsa@...hat.com, leo.yan@...aro.org, mathieu.poirier@...aro.org,
suzuki.poulose@....com, tglx@...utronix.de,
linux-kernel@...r.kernel.org, hpa@...or.com
Subject: [tip:perf/core] perf cs-etm: Modularize main decoder function
Commit-ID: f74f349c211e3e62bc7fe35a132918c7f2c0fafb
Gitweb: https://git.kernel.org/tip/f74f349c211e3e62bc7fe35a132918c7f2c0fafb
Author: Mathieu Poirier <mathieu.poirier@...aro.org>
AuthorDate: Tue, 12 Feb 2019 10:16:16 -0700
Committer: Arnaldo Carvalho de Melo <acme@...hat.com>
CommitDate: Thu, 14 Feb 2019 15:18:07 -0300
perf cs-etm: Modularize main decoder function
Making the main decoder block 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@...aro.org>
Cc: Jiri Olsa <jolsa@...hat.com>
Cc: Leo Yan <leo.yan@...aro.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Suzuki K Poulouse <suzuki.poulose@....com>
Cc: linux-arm-kernel@...ts.infradead.org
Link: http://lkml.kernel.org/r/20190212171618.25355-12-mathieu.poirier@linaro.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@...hat.com>
---
tools/perf/util/cs-etm.c | 41 +++++++++++++++++++++++++++++------------
1 file changed, 29 insertions(+), 12 deletions(-)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c
index d2c90b369e7c..cfa686fe223e 100644
--- a/tools/perf/util/cs-etm.c
+++ b/tools/perf/util/cs-etm.c
@@ -1491,9 +1491,36 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq)
return 0;
}
+static int cs_etm__decode_data_block(struct cs_etm_queue *etmq)
+{
+ int ret = 0;
+ size_t processed = 0;
+
+ /*
+ * Packets are decoded and added to the decoder's packet queue
+ * until the decoder packet processing callback has requested that
+ * processing stops or there is nothing left in the buffer. Normal
+ * operations that stop processing are a timestamp packet or a full
+ * decoder buffer queue.
+ */
+ ret = cs_etm_decoder__process_data_block(etmq->decoder,
+ etmq->offset,
+ &etmq->buf[etmq->buf_used],
+ etmq->buf_len,
+ &processed);
+ if (ret)
+ goto out;
+
+ etmq->offset += processed;
+ etmq->buf_used += processed;
+ etmq->buf_len -= processed;
+
+out:
+ return ret;
+}
+
static int cs_etm__run_decoder(struct cs_etm_queue *etmq)
{
- size_t processed;
int err = 0;
/* Go through each buffer in the queue and decode them one by one */
@@ -1513,20 +1540,10 @@ static int cs_etm__run_decoder(struct cs_etm_queue *etmq)
/* Run trace decoder until buffer consumed or end of trace */
do {
- processed = 0;
- err = cs_etm_decoder__process_data_block(
- etmq->decoder,
- etmq->offset,
- &etmq->buf[etmq->buf_used],
- etmq->buf_len,
- &processed);
+ err = cs_etm__decode_data_block(etmq);
if (err)
return err;
- etmq->offset += processed;
- etmq->buf_used += processed;
- etmq->buf_len -= processed;
-
/* Process each packet in this chunk */
while (1) {
err = cs_etm_decoder__get_packet(etmq->decoder,
Powered by blists - more mailing lists