Commit f74f349c authored by Mathieu Poirier's avatar Mathieu Poirier Committed by Arnaldo Carvalho de Melo

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: default avatarMathieu 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-12-mathieu.poirier@linaro.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent 23cfcd6d
...@@ -1491,9 +1491,36 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq) ...@@ -1491,9 +1491,36 @@ static int cs_etm__set_sample_flags(struct cs_etm_queue *etmq)
return 0; 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) static int cs_etm__run_decoder(struct cs_etm_queue *etmq)
{ {
size_t processed;
int err = 0; int err = 0;
/* Go through each buffer in the queue and decode them one by one */ /* 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) ...@@ -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 */ /* Run trace decoder until buffer consumed or end of trace */
do { do {
processed = 0; err = cs_etm__decode_data_block(etmq);
err = cs_etm_decoder__process_data_block(
etmq->decoder,
etmq->offset,
&etmq->buf[etmq->buf_used],
etmq->buf_len,
&processed);
if (err) if (err)
return err; return err;
etmq->offset += processed;
etmq->buf_used += processed;
etmq->buf_len -= processed;
/* Process each packet in this chunk */ /* Process each packet in this chunk */
while (1) { while (1) {
err = cs_etm_decoder__get_packet(etmq->decoder, err = cs_etm_decoder__get_packet(etmq->decoder,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment