This patch adds a list structure to the decoder data to allow each decoded CoreSight ID to be associated with the callback context.
This allows the tracking of the source of the packets in the perf report -D command.
The code was contributed by Mike Leach in a separate commit which had to be adjusted and distributed across several patches.
Cc: Mike Leach mike.leach@linaro.org Signed-off-by: Tor Jeremiassen tor@ti.com --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 24 ++++++++++++++++++++++++ tools/perf/util/cs-etm-decoder/cs-etm-decoder.h | 5 +++++ 2 files changed, 29 insertions(+)
diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c index b277835..9d601df 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -29,6 +29,14 @@
#define MAX_BUFFER 1024
+struct cs_etm_decoder; + +struct cs_etm_channel { + struct cs_etm_decoder *decoder; + uint8_t cs_id; + struct list_head chan_list; +}; + struct cs_etm_decoder { struct cs_etm_state state; dcd_tree_handle_t dcd_tree; @@ -105,3 +113,19 @@ cs_etm_decoder__process_data_block(struct cs_etm_decoder *decoder, decoder->state.err = ret; return &decoder->state; } + +struct cs_etm_channel *cs_etm_decoder__create_channel_item( + struct cs_etm_decoder *decoder, + uint8_t cs_id) +{ + struct cs_etm_channel *chan; + + chan = (struct cs_etm_channel *) zalloc(sizeof(*chan)); + if (!chan) + return NULL; + + chan->decoder = decoder; + chan->cs_id = cs_id; + list_add(&(chan->chan_list), &(decoder->channel_list)); + return chan; +} diff --git a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h index 9420f0f..ab9880c 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.h @@ -105,6 +105,11 @@ enum { CS_ETM_OPERATION_DECODE, };
+struct cs_etm_channel; + +struct cs_etm_channel *cs_etm_decoder__create_channel_item( + struct cs_etm_decoder *decoder, + uint8_t cs_id); const struct cs_etm_state * cs_etm_decoder__process_data_block(struct cs_etm_decoder *decoder, uint64_t indx, const uint8_t *buf,