Commit b1fcd190 authored by Jiri Olsa's avatar Jiri Olsa Committed by Arnaldo Carvalho de Melo

libperf: Add PERF_RECORD_SAMPLE 'struct sample_event' to perf/event.h

Move the PERF_RECORD_SAMPLE event definition to libperf's event.h header
include.

In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used
events to their generic '__u*' versions.
Signed-off-by: default avatarJiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190825181752.722-13-jolsa@kernel.orgSigned-off-by: default avatarArnaldo Carvalho de Melo <acme@redhat.com>
parent b1b51014
...@@ -104,4 +104,9 @@ struct bpf_event { ...@@ -104,4 +104,9 @@ struct bpf_event {
__u8 tag[BPF_TAG_SIZE]; // prog tag __u8 tag[BPF_TAG_SIZE]; // prog tag
}; };
struct sample_event {
struct perf_event_header header;
__u64 array[];
};
#endif /* __LIBPERF_EVENT_H */ #endif /* __LIBPERF_EVENT_H */
...@@ -37,11 +37,6 @@ ...@@ -37,11 +37,6 @@
/* perf sample has 16 bits size limit */ /* perf sample has 16 bits size limit */
#define PERF_SAMPLE_MAX_SIZE (1 << 16) #define PERF_SAMPLE_MAX_SIZE (1 << 16)
struct sample_event {
struct perf_event_header header;
u64 array[];
};
struct regs_dump { struct regs_dump {
u64 abi; u64 abi;
u64 mask; u64 mask;
......
...@@ -587,7 +587,7 @@ struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist, ...@@ -587,7 +587,7 @@ struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,
static int perf_evlist__event2id(struct evlist *evlist, static int perf_evlist__event2id(struct evlist *evlist,
union perf_event *event, u64 *id) union perf_event *event, u64 *id)
{ {
const u64 *array = event->sample.array; const __u64 *array = event->sample.array;
ssize_t n; ssize_t n;
n = (event->header.size - sizeof(event->header)) >> 3; n = (event->header.size - sizeof(event->header)) >> 3;
......
...@@ -2009,7 +2009,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel, ...@@ -2009,7 +2009,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel,
struct perf_sample *sample) struct perf_sample *sample)
{ {
u64 type = evsel->core.attr.sample_type; u64 type = evsel->core.attr.sample_type;
const u64 *array = event->sample.array; const __u64 *array = event->sample.array;
bool swapped = evsel->needs_swap; bool swapped = evsel->needs_swap;
union u64_swap u; union u64_swap u;
...@@ -2099,7 +2099,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event, ...@@ -2099,7 +2099,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event,
{ {
u64 type = evsel->core.attr.sample_type; u64 type = evsel->core.attr.sample_type;
bool swapped = evsel->needs_swap; bool swapped = evsel->needs_swap;
const u64 *array; const __u64 *array;
u16 max_size = event->header.size; u16 max_size = event->header.size;
const void *endp = (void *)event + max_size; const void *endp = (void *)event + max_size;
u64 sz; u64 sz;
...@@ -2378,7 +2378,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel, ...@@ -2378,7 +2378,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel,
u64 *timestamp) u64 *timestamp)
{ {
u64 type = evsel->core.attr.sample_type; u64 type = evsel->core.attr.sample_type;
const u64 *array; const __u64 *array;
if (!(type & PERF_SAMPLE_TIME)) if (!(type & PERF_SAMPLE_TIME))
return -1; return -1;
...@@ -2529,7 +2529,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type, ...@@ -2529,7 +2529,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,
u64 read_format, u64 read_format,
const struct perf_sample *sample) const struct perf_sample *sample)
{ {
u64 *array; __u64 *array;
size_t sz; size_t sz;
/* /*
* used for cross-endian analysis. See git commit 65014ab3 * used for cross-endian analysis. See git commit 65014ab3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment