Thread (34 messages) 34 messages, 4 authors, 2021-01-19

Re: [PATCH v1 6/7] perf cs-etm: Add helper cs_etm__get_pid_fmt()

From: Suzuki K Poulose <suzuki.poulose@arm.com>
Date: 2021-01-11 09:56:32
Also in: lkml

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 <redacted>
Acked-by: Suzuki K Poulose <suzuki.poulose@arm.com>
quoted hunk ↗ jump to hunk
---
  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);

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help