Skip to contentSkip to conversation

perf_sample_id::idx

RFC Applied Jiri Olsa 4 participants 6 messages Aug 9, 2019 – Aug 23, 2019 perf events

lore
Share & tools
lore

Jiri Olsa

author
#0 lore raw

RFC 1/1 perf_sample_id::idx

hi,
what's the perf_sample_id::idx for? It was added in here:
3c659eedada2 perf tools: Add id index

but I dont see any practical usage of it in the sources, when I remove it like below, I get clean build

any idea?

thanks,
jirka

---

tools/perf/util/event.h +1 -1
index 70841d115349..24b90f68d616 100644
@@ -498,7 +498,7 @@ struct tracing_data_event {
 
 struct id_index_entry {
 	u64 id;
-	u64 idx;
+	u64 idx; /* deprecated */
 	u64 cpu;
 	u64 tid;
 };
tools/perf/util/evlist.c +3 -4
index c4489a1ad6bc..e55133cacb64 100644
@@ -519,11 +519,11 @@ int perf_evlist__id_add_fd(struct evlist *evlist,
 }
 
 static void perf_evlist__set_sid_idx(struct evlist *evlist,
-				     struct evsel *evsel, int idx, int cpu,
+				     struct evsel *evsel, int cpu,
 				     int thread)
 {
 	struct perf_sample_id *sid = SID(evsel, cpu, thread);
-	sid->idx = idx;
+
 	if (evlist->core.cpus && cpu >= 0)
 		sid->cpu = evlist->core.cpus->map[cpu];
 	else
@@ -795,8 +795,7 @@ static int perf_evlist__mmap_per_evsel(struct evlist *evlist, int idx,
 			if (perf_evlist__id_add_fd(evlist, evsel, cpu, thread,
 						   fd) < 0)
 				return -1;
-			perf_evlist__set_sid_idx(evlist, evsel, idx, cpu,
-						 thread);
+			perf_evlist__set_sid_idx(evlist, evsel, cpu, thread);
 		}
 	}
 
tools/perf/util/evsel.h +0 -1
index 3cf35aa782b9..b9d864933d75 100644
@@ -23,7 +23,6 @@ struct perf_sample_id {
 	struct hlist_node 	node;
 	u64		 	id;
 	struct evsel		*evsel;
-	int			idx;
 	int			cpu;
 	pid_t			tid;
 
tools/perf/util/session.c +1 -2
index b9fe71d11bf6..2642d60aa875 100644
@@ -2394,7 +2394,6 @@ int perf_event__process_id_index(struct perf_session *session,
 		sid = perf_evlist__id2sid(evlist, e->id);
 		if (!sid)
 			return -ENOENT;
-		sid->idx = e->idx;
 		sid->cpu = e->cpu;
 		sid->tid = e->tid;
 	}
@@ -2454,7 +2453,7 @@ int perf_event__synthesize_id_index(struct perf_tool *tool,
 				return -ENOENT;
 			}
 
-			e->idx = sid->idx;
+			e->idx = -1;
 			e->cpu = sid->cpu;
 			e->tid = sid->tid;
 		}
#1 lore raw

It will be used for AUX area sampling. A sample will have AUX area data that will be queued for decoding, where there are separate queues for each CPU (per-cpu tracing) or task (per-thread tracing). The sample ID can be used to lookup 'idx' which is effectively the queue number.

Quoted 101 lines

-----Original Message-----
From: Jiri Olsa [mailto:[email protected]]
Sent: Friday, August 9, 2019 12:28 PM
To: Hunter, Adrian <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>; Ingo Molnar <[email protected]>; Namhyung Kim <[email protected]>; Alexander Shishkin <[email protected]>; Peter Zijlstra <[email protected]>; Michael Petlan <[email protected]>; linux- [email protected]
Subject: [RFC] perf_sample_id::idx

hi,
what's the perf_sample_id::idx for? It was added in here:
3c659eedada2 perf tools: Add id index

but I dont see any practical usage of it in the sources, when I remove it like below, I get clean build

any idea?

thanks,
jirka

---

tools/perf/util/event.h index renamed from tools/perf/util/event.h +0 -0

70841d115349..24b90f68d616 100644

tools/perf/util/event.h +1 -1
@@ -498,7 +498,7 @@ struct tracing_data_event {
 
 struct id_index_entry {
 	u64 id;
-	u64 idx;
+	u64 idx; /* deprecated */
 	u64 cpu;
 	u64 tid;
 };
tools/perf/util/evlist.c index renamed from tools/perf/util/evlist.c +0 -0

c4489a1ad6bc..e55133cacb64 100644

tools/perf/util/evlist.c +3 -4
@@ -519,11 +519,11 @@ int perf_evlist__id_add_fd(struct evlist *evlist,  }
 
 static void perf_evlist__set_sid_idx(struct evlist *evlist,
-				     struct evsel *evsel, int idx, int cpu,
+				     struct evsel *evsel, int cpu,
 				     int thread)
 {
 	struct perf_sample_id *sid = SID(evsel, cpu, thread);
-	sid->idx = idx;
+
 	if (evlist->core.cpus && cpu >= 0)
 		sid->cpu = evlist->core.cpus->map[cpu];
 	else
@@ -795,8 +795,7 @@ static int perf_evlist__mmap_per_evsel(struct evlist
 *evlist, int idx,
 			if (perf_evlist__id_add_fd(evlist, evsel, cpu, thread,
 						   fd) < 0)
 				return -1;
-			perf_evlist__set_sid_idx(evlist, evsel, idx, cpu,
-						 thread);
+			perf_evlist__set_sid_idx(evlist, evsel, cpu, thread);
 		}
 	}
tools/perf/util/evsel.h index renamed from tools/perf/util/evsel.h +0 -0

3cf35aa782b9..b9d864933d75 100644

tools/perf/util/evsel.h +0 -1
@@ -23,7 +23,6 @@ struct perf_sample_id {
 	struct hlist_node 	node;
 	u64		 	id;
 	struct evsel		*evsel;
-	int			idx;
 	int			cpu;
 	pid_t			tid;
 
tools/perf/util/session.c index renamed from tools/perf/util/session.c +0 -0

b9fe71d11bf6..2642d60aa875 100644

tools/perf/util/session.c +0 -1
@@ -2394,7 +2394,6 @@ int perf_event__process_id_index(struct
 perf_session *session,
 		sid = perf_evlist__id2sid(evlist, e->id);
 		if (!sid)
 			return -ENOENT;
-		sid->idx = e->idx;
 		sid->cpu = e->cpu;
 		sid->tid = e->tid;
tools/perf/util/session.c +1 -1
 	}
@@ -2454,7 +2453,7 @@ int perf_event__synthesize_id_index(struct
 perf_tool *tool,
 				return -ENOENT;
 			}
 
-			e->idx = sid->idx;
+			e->idx = -1;
 			e->cpu = sid->cpu;
 			e->tid = sid->tid;

}

#2 lore raw

Em Fri, Aug 09, 2019 at 03:20:14PM +0000, Hunter, Adrian escreveu:

Quoted 5 lines

It will be used for AUX area sampling. A sample will have AUX area data that will be queued for decoding, where there are separate queues for each CPU (per-cpu tracing) or task (per-thread tracing). The sample ID can be used to lookup 'idx' which is effectively the queue number.

Would be good to have this as a comment in the perf_sample_id struct definition :-)

- Arnaldo

Quoted 101 lines
Quoted 101 lines

-----Original Message-----
From: Jiri Olsa [mailto:[email protected]]
Sent: Friday, August 9, 2019 12:28 PM
To: Hunter, Adrian <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>; Ingo Molnar <[email protected]>; Namhyung Kim <[email protected]>; Alexander Shishkin <[email protected]>; Peter Zijlstra <[email protected]>; Michael Petlan <[email protected]>; linux- [email protected]
Subject: [RFC] perf_sample_id::idx

hi,
what's the perf_sample_id::idx for? It was added in here:
3c659eedada2 perf tools: Add id index

but I dont see any practical usage of it in the sources, when I remove it like below, I get clean build

any idea?

thanks,
jirka

---

tools/perf/util/event.h index renamed from tools/perf/util/event.h +0 -0

70841d115349..24b90f68d616 100644

tools/perf/util/event.h +1 -1
@@ -498,7 +498,7 @@ struct tracing_data_event {
 
 struct id_index_entry {
 	u64 id;
-	u64 idx;
+	u64 idx; /* deprecated */
 	u64 cpu;
 	u64 tid;
 };
tools/perf/util/evlist.c index renamed from tools/perf/util/evlist.c +0 -0

c4489a1ad6bc..e55133cacb64 100644

tools/perf/util/evlist.c +3 -4
@@ -519,11 +519,11 @@ int perf_evlist__id_add_fd(struct evlist *evlist,  }
 
 static void perf_evlist__set_sid_idx(struct evlist *evlist,
-				     struct evsel *evsel, int idx, int cpu,
+				     struct evsel *evsel, int cpu,
 				     int thread)
 {
 	struct perf_sample_id *sid = SID(evsel, cpu, thread);
-	sid->idx = idx;
+
 	if (evlist->core.cpus && cpu >= 0)
 		sid->cpu = evlist->core.cpus->map[cpu];
 	else
@@ -795,8 +795,7 @@ static int perf_evlist__mmap_per_evsel(struct evlist
 *evlist, int idx,
 			if (perf_evlist__id_add_fd(evlist, evsel, cpu, thread,
 						   fd) < 0)
 				return -1;
-			perf_evlist__set_sid_idx(evlist, evsel, idx, cpu,
-						 thread);
+			perf_evlist__set_sid_idx(evlist, evsel, cpu, thread);
 		}
 	}
tools/perf/util/evsel.h index renamed from tools/perf/util/evsel.h +0 -0

3cf35aa782b9..b9d864933d75 100644

tools/perf/util/evsel.h +0 -1
@@ -23,7 +23,6 @@ struct perf_sample_id {
 	struct hlist_node 	node;
 	u64		 	id;
 	struct evsel		*evsel;
-	int			idx;
 	int			cpu;
 	pid_t			tid;
 
tools/perf/util/session.c index renamed from tools/perf/util/session.c +0 -0

b9fe71d11bf6..2642d60aa875 100644

tools/perf/util/session.c +0 -1
@@ -2394,7 +2394,6 @@ int perf_event__process_id_index(struct
 perf_session *session,
 		sid = perf_evlist__id2sid(evlist, e->id);
 		if (!sid)
 			return -ENOENT;
-		sid->idx = e->idx;
 		sid->cpu = e->cpu;
 		sid->tid = e->tid;
tools/perf/util/session.c +1 -1
 	}
@@ -2454,7 +2453,7 @@ int perf_event__synthesize_id_index(struct
 perf_tool *tool,
 				return -ENOENT;
 			}
 
-			e->idx = sid->idx;
+			e->idx = -1;
 			e->cpu = sid->cpu;
 			e->tid = sid->tid;

}

Signature · 1 line
- Arnaldo
reviewer
#3 lore raw
Quoted 10 lines · Arnaldo Carvalho de Melo

Em Fri, Aug 09, 2019 at 03:20:14PM +0000, Hunter, Adrian escreveu:

Quoted 5 lines

It will be used for AUX area sampling. A sample will have AUX area data that will be queued for decoding, where there are separate queues for each CPU (per-cpu tracing) or task (per-thread tracing). The sample ID can be used to lookup 'idx' which is effectively the queue number.

Would be good to have this as a comment in the perf_sample_id struct definition :-)

From 45d57bd7b25c9864f21e25534274ea461ff83d9d Mon Sep 17 00:00:00 2001
From: Adrian Hunter <[email protected]>
Date: Mon, 12 Aug 2019 12:06:31 +0300
Subject: [PATCH] perf tools: Add comment for idx in struct perf_sample_id

'idx' was added as preparation for AUX area sampling. Add a comment to describe why.

---
 tools/perf/util/evsel.h | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/util/evsel.h +7 -0
index cad54e8ba522..ba13eb771775 100644
@@ -22,6 +22,13 @@ struct perf_sample_id {
 	struct hlist_node 	node;
 	u64		 	id;
 	struct perf_evsel	*evsel;
+	/*
+	 * 'idx' will be used for AUX area sampling. A sample will have AUX area
+	 * data that will be queued for decoding, where there are separate
+	 * queues for each CPU (per-cpu tracing) or task (per-thread tracing).
+	 * The sample ID can be used to lookup 'idx' which is effectively the
+	 * queue number.
+	 */
 	int			idx;
 	int			cpu;
 	pid_t			tid;
Signature · 1 line
2.17.1
#4 lore raw

Em Mon, Aug 12, 2019 at 12:09:35PM +0300, Adrian Hunter escreveu:

Quoted 11 lines · Arnaldo Carvalho de Melo
Quoted 10 lines

Em Fri, Aug 09, 2019 at 03:20:14PM +0000, Hunter, Adrian escreveu:

Quoted 5 lines

It will be used for AUX area sampling. A sample will have AUX area data that will be queued for decoding, where there are separate queues for each CPU (per-cpu tracing) or task (per-thread tracing). The sample ID can be used to lookup 'idx' which is effectively the queue number.

Would be good to have this as a comment in the perf_sample_id struct definition :-)

Thanks, applied to perf/core.

Quoted 34 lines
Quoted 2 lines

From 45d57bd7b25c9864f21e25534274ea461ff83d9d Mon Sep 17 00:00:00 2001

From: Adrian Hunter <[email protected]>
Date: Mon, 12 Aug 2019 12:06:31 +0300
Subject: [PATCH] perf tools: Add comment for idx in struct perf_sample_id

'idx' was added as preparation for AUX area sampling. Add a comment to describe why.

---
 tools/perf/util/evsel.h | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/util/evsel.h +7 -0
index cad54e8ba522..ba13eb771775 100644
@@ -22,6 +22,13 @@ struct perf_sample_id {
 	struct hlist_node 	node;
 	u64		 	id;
 	struct perf_evsel	*evsel;
+	/*
+	 * 'idx' will be used for AUX area sampling. A sample will have AUX area
+	 * data that will be queued for decoding, where there are separate
+	 * queues for each CPU (per-cpu tracing) or task (per-thread tracing).
+	 * The sample ID can be used to lookup 'idx' which is effectively the
+	 * queue number.
+	 */
 	int			idx;
 	int			cpu;
 	pid_t			tid;
Signature · 1 line
2.17.1
Signature · 1 line
- Arnaldo
merge bot Applied
#5 lore raw

[tip: perf/core] perf evsel: Add comment for 'idx' member in 'struct perf_sample_id

In reply to Adrian Hunter
The following commit has been merged into the perf/core branch of tip:

The following commit has been merged into the perf/core branch of tip:

Commit-ID:     3c84e65a533dbaa1a29bfd847deca73704b675eb
Gitweb:        https://git.kernel.org/tip/3c84e65a533dbaa1a29bfd847deca73704b675eb
Author:        Adrian Hunter <[email protected]>
AuthorDate:    Mon, 12 Aug 2019 12:09:35 +03:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Tue, 20 Aug 2019 12:17:45 -03:00

perf evsel: Add comment for 'idx' member in 'struct perf_sample_id

The 'idx' member was added as preparation for AUX area sampling. Add a comment to describe why.

---
 tools/perf/util/evsel.h | 7 +++++++
 1 file changed, 7 insertions(+)
tools/perf/util/evsel.h +7 -0
index 9cd6e3a..efe0806 100644
@@ -23,6 +23,13 @@ struct perf_sample_id {
 	struct hlist_node 	node;
 	u64		 	id;
 	struct evsel		*evsel;
+       /*
+	* 'idx' will be used for AUX area sampling. A sample will have AUX area
+	* data that will be queued for decoding, where there are separate
+	* queues for each CPU (per-cpu tracing) or task (per-thread tracing).
+	* The sample ID can be used to lookup 'idx' which is effectively the
+	* queue number.
+	*/
 	int			idx;
 	int			cpu;
 	pid_t			tid;