Skip to content

Commit 7b4fe2f

Browse files
cs-etm: account for each trace buffer in the queue
Function cs_etm__get_trace() picks up a single buffer from the current queue. As such when multiple buffers are present in the queue several iteration of the fetch-decode block need to be run in order to process all the trace data. Signed-off-by: Mathieu Poirier <mathieu.poirier@linaro.org>
1 parent c14318f commit 7b4fe2f

1 file changed

Lines changed: 9 additions & 8 deletions

File tree

tools/perf/util/cs-etm.c

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -326,7 +326,6 @@ static int cs_etm__get_trace(struct cs_etm_buffer *buff, struct cs_etm_queue *et
326326
buff->len = sizeof(cstrace);
327327
buff->buf = cstrace;
328328
*/
329-
etmq->stop = true;
330329

331330
buff->ref_timestamp = aux_buffer->reference;
332331

@@ -339,10 +338,7 @@ static int cs_etm__get_trace(struct cs_etm_buffer *buff, struct cs_etm_queue *et
339338
if (etmq->step_through_buffers)
340339
etmq->stop = true;
341340

342-
if (buff->len == 0)
343-
return cs_etm__get_trace(buff,etmq);
344-
345-
return 0;
341+
return buff->len;
346342
}
347343

348344
static struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm,
@@ -819,12 +815,16 @@ static int cs_etm__sample(struct cs_etm_queue *etmq)
819815

820816
static int cs_etm__run_decoder(struct cs_etm_queue *etmq, u64 *timestamp)
821817
{
822-
struct cs_etm_buffer buffer = {.buf = 0,};
823-
size_t buffer_used = 0;
818+
struct cs_etm_buffer buffer;
819+
size_t buffer_used;
824820
int err = 0;
825821

822+
/* Go through each buffer in the queue and decode them one by one */
823+
more:
824+
buffer_used = 0;
825+
memset(&buffer, 0, sizeof(buffer));
826826
err = cs_etm__get_trace(&buffer,etmq);
827-
if (err)
827+
if (err <= 0)
828828
return err;
829829

830830
do {
@@ -842,6 +842,7 @@ static int cs_etm__run_decoder(struct cs_etm_queue *etmq, u64 *timestamp)
842842
cs_etm__sample(etmq);
843843
}
844844
} while (!etmq->eot && (buffer.len > buffer_used));
845+
goto more;
845846

846847
(void) timestamp;
847848

0 commit comments

Comments
 (0)