On Fri, Sep 22, 2017 at 04:03:30AM -0500, Tor Jeremiassen wrote:
As events are processed, based on the time stamp of the event (or if timeless decoding is enabled), the coresight event queues are updated (or initialized on the first call), prior to any traces being decoded.
This patch adds two functions to manage the setup and update of the coresight event queues.
Signed-off-by: Tor Jeremiassen tor@ti.com
tools/perf/util/cs-etm.c | 55 ++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/cs-etm.h | 2 ++ 2 files changed, 57 insertions(+)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 62556a7..0516301 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -288,6 +288,61 @@ struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm, return NULL; } +static int cs_etm__setup_queue(struct cs_etm_auxtrace *etm,
struct auxtrace_queue *queue,
unsigned int queue_nr)
+{
- struct cs_etm_queue *etmq = queue->priv;
- if (list_empty(&queue->head))
return 0;
- if (!etmq) {
etmq = cs_etm__alloc_queue(etm, queue_nr);
if (!etmq)
return -ENOMEM;
queue->priv = etmq;
if (queue->cpu != -1)
etmq->cpu = queue->cpu;
etmq->tid = queue->tid;
if (etm->sampling_mode) {
if (etm->timeless_decoding)
etmq->step_through_buffers = true;
if (etm->timeless_decoding)
etmq->use_buffer_pid_tid = true;
}
- }
- return 0;
+}
+static int cs_etm__setup_queues(struct cs_etm_auxtrace *etm) +{
- unsigned int i;
- int ret;
- for (i = 0; i < etm->queues.nr_queues; i++) {
ret = cs_etm__setup_queue(etm, &etm->queues.queue_array[i], i);
if (ret)
When there is a failure all the previously allocated struct cs_etm_queue should be freed. Each function should revert what it did when a failure condition occurs. I did not make that modification so please do so.
return ret;
- }
- return 0;
+}
+int cs_etm__update_queues(struct cs_etm_auxtrace *etm) +{
- if (etm->queues.new_data) {
etm->queues.new_data = false;
return cs_etm__setup_queues(etm);
- }
- return 0;
+}
struct cs_etm_queue *cs_etm__cpu_to_etmq(struct cs_etm_auxtrace *etm, int cpu) { int q, j; diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h index 0bb35d6..d1cb049 100644 --- a/tools/perf/util/cs-etm.h +++ b/tools/perf/util/cs-etm.h @@ -106,4 +106,6 @@ struct cs_etm_queue *cs_etm__cpu_to_etmq(struct cs_etm_auxtrace *etm, int cpu); struct cs_etm_queue *cs_etm__alloc_queue(struct cs_etm_auxtrace *etm, unsigned int queue_nr); +int cs_etm__update_queues(struct cs_etm_auxtrace *etm);
#endif
2.7.4
CoreSight mailing list CoreSight@lists.linaro.org https://lists.linaro.org/mailman/listinfo/coresight