Skip to content

Commit 14a05e1

Browse files
mathieupoirieracmel
authored andcommitted
perf auxtrace: Add perf_evlist pointer to *info_priv_size()
On some architecture the size of the private header may be dependent on the number of tracers used in the session. As such adding a "struct perf_evlist *" parameter, which should contain all the required information. Also adjusting the existing client of the interface to take the new parameter into account. Signed-off-by: Mathieu Poirier <[email protected]> Acked-by: Adrian Hunter <[email protected]> Cc: Al Grant <[email protected]> Cc: Chunyan Zhang <[email protected]> Cc: [email protected] Cc: [email protected] Cc: Mike Leach <[email protected]> Cc: Peter Zijlstra <[email protected]> Cc: Rabin Vincent <[email protected]> Cc: Tor Jeremiassen <[email protected]> Link: http://lkml.kernel.org/r/[email protected] Signed-off-by: Arnaldo Carvalho de Melo <[email protected]>
1 parent a639a62 commit 14a05e1

File tree

4 files changed

+14
-7
lines changed

4 files changed

+14
-7
lines changed

tools/perf/arch/x86/util/intel-bts.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,9 @@ struct branch {
6060
u64 misc;
6161
};
6262

63-
static size_t intel_bts_info_priv_size(struct auxtrace_record *itr __maybe_unused)
63+
static size_t
64+
intel_bts_info_priv_size(struct auxtrace_record *itr __maybe_unused,
65+
struct perf_evlist *evlist __maybe_unused)
6466
{
6567
return INTEL_BTS_AUXTRACE_PRIV_SIZE;
6668
}

tools/perf/arch/x86/util/intel-pt.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -273,7 +273,9 @@ intel_pt_pmu_default_config(struct perf_pmu *intel_pt_pmu)
273273
return attr;
274274
}
275275

276-
static size_t intel_pt_info_priv_size(struct auxtrace_record *itr __maybe_unused)
276+
static size_t
277+
intel_pt_info_priv_size(struct auxtrace_record *itr __maybe_unused,
278+
struct perf_evlist *evlist __maybe_unused)
277279
{
278280
return INTEL_PT_AUXTRACE_PRIV_SIZE;
279281
}

tools/perf/util/auxtrace.c

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -478,10 +478,11 @@ void auxtrace_heap__pop(struct auxtrace_heap *heap)
478478
heap_array[last].ordinal);
479479
}
480480

481-
size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr)
481+
size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
482+
struct perf_evlist *evlist)
482483
{
483484
if (itr)
484-
return itr->info_priv_size(itr);
485+
return itr->info_priv_size(itr, evlist);
485486
return 0;
486487
}
487488

@@ -852,7 +853,7 @@ int perf_event__synthesize_auxtrace_info(struct auxtrace_record *itr,
852853
int err;
853854

854855
pr_debug2("Synthesizing auxtrace information\n");
855-
priv_size = auxtrace_record__info_priv_size(itr);
856+
priv_size = auxtrace_record__info_priv_size(itr, session->evlist);
856857
ev = zalloc(sizeof(struct auxtrace_info_event) + priv_size);
857858
if (!ev)
858859
return -ENOMEM;

tools/perf/util/auxtrace.h

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -293,7 +293,8 @@ struct auxtrace_record {
293293
int (*recording_options)(struct auxtrace_record *itr,
294294
struct perf_evlist *evlist,
295295
struct record_opts *opts);
296-
size_t (*info_priv_size)(struct auxtrace_record *itr);
296+
size_t (*info_priv_size)(struct auxtrace_record *itr,
297+
struct perf_evlist *evlist);
297298
int (*info_fill)(struct auxtrace_record *itr,
298299
struct perf_session *session,
299300
struct auxtrace_info_event *auxtrace_info,
@@ -429,7 +430,8 @@ int auxtrace_parse_snapshot_options(struct auxtrace_record *itr,
429430
int auxtrace_record__options(struct auxtrace_record *itr,
430431
struct perf_evlist *evlist,
431432
struct record_opts *opts);
432-
size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr);
433+
size_t auxtrace_record__info_priv_size(struct auxtrace_record *itr,
434+
struct perf_evlist *evlist);
433435
int auxtrace_record__info_fill(struct auxtrace_record *itr,
434436
struct perf_session *session,
435437
struct auxtrace_info_event *auxtrace_info,

0 commit comments

Comments
 (0)