RE: [RFC] perf_sample_id::idx

From: Hunter, Adrian
Date: Fri Aug 09 2019 - 11:20:20 EST


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.

> -----Original Message-----
> From: Jiri Olsa [mailto:jolsa@xxxxxxxxxx]
> Sent: Friday, August 9, 2019 12:28 PM
> To: Hunter, Adrian <adrian.hunter@xxxxxxxxx>
> Cc: Arnaldo Carvalho de Melo <acme@xxxxxxxxxx>; Ingo Molnar
> <mingo@xxxxxxxxxx>; Namhyung Kim <namhyung@xxxxxxxxxx>; Alexander
> Shishkin <alexander.shishkin@xxxxxxxxxxxxxxx>; Peter Zijlstra
> <a.p.zijlstra@xxxxxxxxx>; Michael Petlan <mpetlan@xxxxxxxxxx>; linux-
> kernel@xxxxxxxxxxxxxxx
> 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
>
>
> ---
> diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index
> 70841d115349..24b90f68d616 100644
> --- a/tools/perf/util/event.h
> +++ b/tools/perf/util/event.h
> @@ -498,7 +498,7 @@ struct tracing_data_event {
>
> struct id_index_entry {
> u64 id;
> - u64 idx;
> + u64 idx; /* deprecated */
> u64 cpu;
> u64 tid;
> };
> diff --git a/tools/perf/util/evlist.c b/tools/perf/util/evlist.c index
> c4489a1ad6bc..e55133cacb64 100644
> --- a/tools/perf/util/evlist.c
> +++ b/tools/perf/util/evlist.c
> @@ -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);
> }
> }
>
> diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index
> 3cf35aa782b9..b9d864933d75 100644
> --- a/tools/perf/util/evsel.h
> +++ b/tools/perf/util/evsel.h
> @@ -23,7 +23,6 @@ struct perf_sample_id {
> struct hlist_node node;
> u64 id;
> struct evsel *evsel;
> - int idx;
> int cpu;
> pid_t tid;
>
> diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index
> b9fe71d11bf6..2642d60aa875 100644
> --- a/tools/perf/util/session.c
> +++ b/tools/perf/util/session.c
> @@ -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;
> }