On 1/9/21 7:44 AM, Leo Yan wrote:
This patch adds helper function cs_etm__get_pid_fmt(), by passing parameter "traceID", it returns the corresponding PID format.
Signed-off-by: Leo Yan leo.yan@linaro.org
Acked-by: Suzuki K Poulose suzuki.poulose@arm.com
tools/perf/util/cs-etm.c | 18 ++++++++++++++++++ tools/perf/util/cs-etm.h | 1 + 2 files changed, 19 insertions(+)
diff --git a/tools/perf/util/cs-etm.c b/tools/perf/util/cs-etm.c index 8c125134a756..6705d39c8cee 100644 --- a/tools/perf/util/cs-etm.c +++ b/tools/perf/util/cs-etm.c @@ -157,6 +157,24 @@ int cs_etm__get_cpu(u8 trace_chan_id, int *cpu) return 0; } +int cs_etm__get_pid_fmt(u8 trace_chan_id, u64 *pid_fmt) +{
- struct int_node *inode;
- u64 *metadata;
- inode = intlist__find(traceid_list, trace_chan_id);
- if (!inode)
return -EINVAL;
- metadata = inode->priv;
- if (metadata[CS_ETM_MAGIC] == __perf_cs_etmv3_magic)
*pid_fmt = metadata[CS_ETM_PID_FMT];
- else
*pid_fmt = metadata[CS_ETMV4_PID_FMT];
- return 0;
+}
- void cs_etm__etmq_set_traceid_queue_timestamp(struct cs_etm_queue *etmq, u8 trace_chan_id) {
diff --git a/tools/perf/util/cs-etm.h b/tools/perf/util/cs-etm.h index 8cbbea6100a1..98801040175f 100644 --- a/tools/perf/util/cs-etm.h +++ b/tools/perf/util/cs-etm.h @@ -175,6 +175,7 @@ struct cs_etm_packet_queue { int cs_etm__process_auxtrace_info(union perf_event *event, struct perf_session *session); int cs_etm__get_cpu(u8 trace_chan_id, int *cpu); +int cs_etm__get_pid_fmt(u8 trace_chan_id, u64 *pid_fmt); int cs_etm__etmq_set_tid(struct cs_etm_queue *etmq, pid_t tid, u8 trace_chan_id); bool cs_etm__etmq_is_timeless(struct cs_etm_queue *etmq);