Each perf event is passed to the coresight etm event processing function, so that coresight specific functionality can be invoked.
This patch adds the coresight etm event processing function which manages the handling of the events that need special handling for trace decoding.
Signed-off-by: Tor Jeremiassen tor@ti.com --- tools/perf/util/cs-etm-decoder/cs-etm-decoder.c | 3 -- tools/perf/util/cs-etm.c | 45 ++++++++++++++++++++++--- 2 files changed, 40 insertions(+), 8 deletions(-)
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 73218a9..f3c6625 100644 --- a/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c +++ b/tools/perf/util/cs-etm-decoder/cs-etm-decoder.c @@ -80,9 +80,6 @@ int cs_etm_decoder__reset(struct cs_etm_decoder *decoder) { ocsd_datapath_resp_t dp_ret;
- if (!decoder) - return -CS_ETM_ERR_PARAM; - dp_ret = ocsd_dt_process_data(decoder->dcd_tree, OCSD_OP_RESET, 0, 0, NULL, NULL); if (OCSD_DATA_RESP_IS_FATAL(dp_ret)) diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index ba60be8..c769da9 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -30,6 +30,7 @@ #include "evlist.h" #include "intlist.h" #include "machine.h" +#include "map.h" #include "perf.h" #include "thread.h" #include "thread_map.h" @@ -705,11 +706,45 @@ static int cs_etm__process_event(struct perf_session *session, struct perf_sample *sample, struct perf_tool *tool) { - (void) session; - (void) event; - (void) sample; - (void) tool; - return 0; + struct cs_etm_auxtrace *etm = container_of(session->auxtrace, + struct cs_etm_auxtrace, + auxtrace); + struct cs_etm_queue *etmq; + u64 timestamp; + int err = 0; + + if (dump_trace) + return 0; + + if (!tool->ordered_events) { + pr_err("CoreSight ETM Trace requires ordered events\n"); + return -EINVAL; + } + + if (sample->time && (sample->time != (u64) -1)) + timestamp = sample->time; + else + timestamp = 0; + + if (timestamp || etm->timeless_decoding) { + err = cs_etm__update_queues(etm); + if (err) + return err; + } + + etmq = cs_etm__cpu_to_etmq(etm, sample->cpu); + if (!etmq) + return -1; + + if (etm->timeless_decoding) { + if (event->header.type == PERF_RECORD_EXIT) + err = cs_etm__process_timeless_queues(etm, + event->fork.tid, + sample->time); + } else if (timestamp) + err = cs_etm__process_queues(etm, timestamp); + + return err; }
static int cs_etm__process_auxtrace_event(struct perf_session *session,