From 1345e2ee87a83c758f336f03f7fb305bc5e24490 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 25 Aug 2019 20:17:41 +0200 Subject: libperf: Add PERF_RECORD_MMAP 'struct mmap_event' to perf/event.h Move the mmap_event 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. Perf added 'u*' types mainly to ease up printing __u64 values as stated in the linux/types.h comment: /* * We define u64 as uint64_t for every architecture * so that we can print it with "%"PRIx64 without getting warnings. * * typedef __u64 u64; * typedef __s64 s64; */ Add and use new PRI_lu64 and PRI_lx64 macros for that. Use extra '_' to ease up reading and differentiate them from standard PRI*64 macros. Committer notes: Fixup the PRI_l[ux]64 macros on 32-bit arches, conditionally defining it with that extra 'l' modifier only on arches where __u64 is long long, leaving it aside on 32-bit arches. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190825181752.722-2-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/util/python.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'tools/perf/util/python.c') diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 75ecc32a4427..55ff0c3182d6 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -130,8 +130,8 @@ static PyObject *pyrf_mmap_event__repr(struct pyrf_event *pevent) PyObject *ret; char *s; - if (asprintf(&s, "{ type: mmap, pid: %u, tid: %u, start: %#" PRIx64 ", " - "length: %#" PRIx64 ", offset: %#" PRIx64 ", " + if (asprintf(&s, "{ type: mmap, pid: %u, tid: %u, start: %#" PRI_lx64 ", " + "length: %#" PRI_lx64 ", offset: %#" PRI_lx64 ", " "filename: %s }", pevent->event.mmap.pid, pevent->event.mmap.tid, pevent->event.mmap.start, pevent->event.mmap.len, -- cgit From bceb59b1f28d1ca812d816fd8f33c72b1a8378fb Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 25 Aug 2019 20:17:45 +0200 Subject: libperf: Add PERF_RECORD_FORK 'struct fork_event' to perf/event.h Move the fork_event event definition into 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. Perf added 'u*' types mainly to ease up printing __u64 values as stated in the linux/types.h comment: /* * We define u64 as uint64_t for every architecture * so that we can print it with "%"PRIx64 without getting warnings. * * typedef __u64 u64; * typedef __s64 s64; */ Add and use new PRI_lu64 and PRI_lx64 macros for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190825181752.722-6-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/include/perf/event.h | 7 +++++++ tools/perf/util/event.h | 7 ------- tools/perf/util/python.c | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) (limited to 'tools/perf/util/python.c') diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h index b90a8a21e613..c7cae58d2535 100644 --- a/tools/perf/lib/include/perf/event.h +++ b/tools/perf/lib/include/perf/event.h @@ -43,4 +43,11 @@ struct namespaces_event { struct perf_ns_link_info link_info[]; }; +struct fork_event { + struct perf_event_header header; + __u32 pid, ppid; + __u32 tid, ptid; + __u64 time; +}; + #endif /* __LIBPERF_EVENT_H */ diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 0d3ac4fd3ecf..38b258cbbd90 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -27,13 +27,6 @@ #define PRI_lx64 PRIx64 #endif -struct fork_event { - struct perf_event_header header; - u32 pid, ppid; - u32 tid, ptid; - u64 time; -}; - struct lost_event { struct perf_event_header header; u64 id; diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 55ff0c3182d6..8bdadb24f6ba 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -170,7 +170,7 @@ static PyMemberDef pyrf_task_event__members[] = { static PyObject *pyrf_task_event__repr(struct pyrf_event *pevent) { return _PyUnicode_FromFormat("{ type: %s, pid: %u, ppid: %u, tid: %u, " - "ptid: %u, time: %" PRIu64 "}", + "ptid: %u, time: %" PRI_lu64 "}", pevent->event.header.type == PERF_RECORD_FORK ? "fork" : "exit", pevent->event.fork.pid, pevent->event.fork.ppid, -- cgit From 5290ed6955ebc481d5cd62f7175e8514931058bc Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 25 Aug 2019 20:17:46 +0200 Subject: libperf: Add PERF_RECORD_LOST 'struct lost_event' to perf/event.h Move the lost_event 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. Perf added 'u*' types mainly to ease up printing __u64 values as stated in the linux/types.h comment: /* * We define u64 as uint64_t for every architecture * so that we can print it with "%"PRIx64 without getting warnings. * * typedef __u64 u64; * typedef __s64 s64; */ Add and use new PRI_lu64 and PRI_lx64 macros for that. Use extra '_' to ease up the reading and differentiate them from standard PRI*64 macros. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190825181752.722-7-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/builtin-sched.c | 2 +- tools/perf/lib/include/perf/event.h | 6 ++++++ tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 6 ------ tools/perf/util/machine.c | 2 +- tools/perf/util/python.c | 4 ++-- 6 files changed, 11 insertions(+), 11 deletions(-) (limited to 'tools/perf/util/python.c') diff --git a/tools/perf/builtin-sched.c b/tools/perf/builtin-sched.c index 0d6b4c3b1a51..025151dcb651 100644 --- a/tools/perf/builtin-sched.c +++ b/tools/perf/builtin-sched.c @@ -2643,7 +2643,7 @@ static int process_lost(struct perf_tool *tool __maybe_unused, timestamp__scnprintf_usec(sample->time, tstr, sizeof(tstr)); printf("%15s ", tstr); - printf("lost %" PRIu64 " events on cpu %d\n", event->lost.lost, sample->cpu); + printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); return 0; } diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h index c7cae58d2535..71045ea8214c 100644 --- a/tools/perf/lib/include/perf/event.h +++ b/tools/perf/lib/include/perf/event.h @@ -50,4 +50,10 @@ struct fork_event { __u64 time; }; +struct lost_event { + struct perf_event_header header; + __u64 id; + __u64 lost; +}; + #endif /* __LIBPERF_EVENT_H */ diff --git a/tools/perf/util/event.c b/tools/perf/util/event.c index 0954f980574f..3bd9fc2a3ae8 100644 --- a/tools/perf/util/event.c +++ b/tools/perf/util/event.c @@ -1480,7 +1480,7 @@ size_t perf_event__fprintf_switch(union perf_event *event, FILE *fp) static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp) { - return fprintf(fp, " lost %" PRIu64 "\n", event->lost.lost); + return fprintf(fp, " lost %" PRI_lu64 "\n", event->lost.lost); } size_t perf_event__fprintf_ksymbol(union perf_event *event, FILE *fp) diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 38b258cbbd90..4a3f50203d04 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -27,12 +27,6 @@ #define PRI_lx64 PRIx64 #endif -struct lost_event { - struct perf_event_header header; - u64 id; - u64 lost; -}; - struct lost_samples_event { struct perf_event_header header; u64 lost; diff --git a/tools/perf/util/machine.c b/tools/perf/util/machine.c index 47430afd3c2d..1ad6e984c2f5 100644 --- a/tools/perf/util/machine.c +++ b/tools/perf/util/machine.c @@ -645,7 +645,7 @@ int machine__process_namespaces_event(struct machine *machine __maybe_unused, int machine__process_lost_event(struct machine *machine __maybe_unused, union perf_event *event, struct perf_sample *sample __maybe_unused) { - dump_printf(": id:%" PRIu64 ": lost:%" PRIu64 "\n", + dump_printf(": id:%" PRI_lu64 ": lost:%" PRI_lu64 "\n", event->lost.id, event->lost.lost); return 0; } diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 8bdadb24f6ba..5be85f50cd1c 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -263,8 +263,8 @@ static PyObject *pyrf_lost_event__repr(struct pyrf_event *pevent) PyObject *ret; char *s; - if (asprintf(&s, "{ type: lost, id: %#" PRIx64 ", " - "lost: %#" PRIx64 " }", + if (asprintf(&s, "{ type: lost, id: %#" PRI_lx64 ", " + "lost: %#" PRI_lx64 " }", pevent->event.lost.id, pevent->event.lost.lost) < 0) { ret = PyErr_NoMemory(); } else { -- cgit From 003c66fec28fea52825b60cad98af8cf11074d76 Mon Sep 17 00:00:00 2001 From: Jiri Olsa Date: Sun, 25 Aug 2019 20:17:49 +0200 Subject: libperf: Add PERF_RECORD_THROTTLE 'struct throttle_event' to perf/event.h Move the PERF_RECORD_THROTTLE event definition into 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. Perf added 'u*' types mainly to ease up printing __u64 values as stated in the linux/types.h comment: /* * We define u64 as uint64_t for every architecture * so that we can print it with "%"PRIx64 without getting warnings. * * typedef __u64 u64; * typedef __s64 s64; */ Add and use new PRI_lu64 and PRI_lx64 macros for that. Use extra '_' to ease up the reading and differentiate them from standard PRI*64 macros. Signed-off-by: Jiri Olsa Cc: Alexander Shishkin Cc: Michael Petlan Cc: Namhyung Kim Cc: Peter Zijlstra Link: http://lkml.kernel.org/r/20190825181752.722-10-jolsa@kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/include/perf/event.h | 7 +++++++ tools/perf/util/event.h | 7 ------- tools/perf/util/python.c | 4 ++-- 3 files changed, 9 insertions(+), 9 deletions(-) (limited to 'tools/perf/util/python.c') diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h index f1830702e49a..ef5ec66b566e 100644 --- a/tools/perf/lib/include/perf/event.h +++ b/tools/perf/lib/include/perf/event.h @@ -73,4 +73,11 @@ struct read_event { __u64 id; }; +struct throttle_event { + struct perf_event_header header; + __u64 time; + __u64 id; + __u64 stream_id; +}; + #endif /* __LIBPERF_EVENT_H */ diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index 008a2839d667..40020f5b0484 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -27,13 +27,6 @@ #define PRI_lx64 PRIx64 #endif -struct throttle_event { - struct perf_event_header header; - u64 time; - u64 id; - u64 stream_id; -}; - #ifndef KSYM_NAME_LEN #define KSYM_NAME_LEN 256 #endif diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index 5be85f50cd1c..d21e270c7823 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -233,8 +233,8 @@ static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent) { struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1); - return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRIu64 ", id: %" PRIu64 - ", stream_id: %" PRIu64 " }", + return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRI_lu64 ", id: %" PRI_lu64 + ", stream_id: %" PRI_lu64 " }", pevent->event.header.type == PERF_RECORD_THROTTLE ? "" : "un", te->time, te->id, te->stream_id); } -- cgit From 69d81f09e1607b577346c0579bf938c1194bff3a Mon Sep 17 00:00:00 2001 From: Arnaldo Carvalho de Melo Date: Mon, 26 Aug 2019 19:02:31 -0300 Subject: libperf: Rename the PERF_RECORD_ structs to have a "perf" suffix Even more, to have a "perf_record_" prefix, so that they match the PERF_RECORD_ enum they map to. Cc: Adrian Hunter Cc: Jiri Olsa Cc: Namhyung Kim Link: https://lkml.kernel.org/n/tip-qbabmcz2a0pkzt72liyuz3p8@git.kernel.org Signed-off-by: Arnaldo Carvalho de Melo --- tools/perf/lib/include/perf/event.h | 24 ++++++++--------- tools/perf/tests/parse-no-sample-id-all.c | 4 +-- tools/perf/util/bpf-event.c | 12 ++++----- tools/perf/util/event.h | 30 ++++++++++----------- tools/perf/util/evsel.c | 4 +-- tools/perf/util/evsel.h | 2 +- tools/perf/util/intel-bts.c | 2 +- tools/perf/util/namespaces.c | 2 +- tools/perf/util/namespaces.h | 4 +-- tools/perf/util/python.c | 44 +++++++++++++++---------------- tools/perf/util/session.c | 2 +- tools/perf/util/thread.c | 4 +-- tools/perf/util/thread.h | 4 +-- 13 files changed, 69 insertions(+), 69 deletions(-) (limited to 'tools/perf/util/python.c') diff --git a/tools/perf/lib/include/perf/event.h b/tools/perf/lib/include/perf/event.h index e768a2dfbe53..36ad3a4a79e6 100644 --- a/tools/perf/lib/include/perf/event.h +++ b/tools/perf/lib/include/perf/event.h @@ -7,7 +7,7 @@ #include #include -struct mmap_event { +struct perf_record_mmap { struct perf_event_header header; __u32 pid, tid; __u64 start; @@ -16,7 +16,7 @@ struct mmap_event { char filename[PATH_MAX]; }; -struct mmap2_event { +struct perf_record_mmap2 { struct perf_event_header header; __u32 pid, tid; __u64 start; @@ -31,33 +31,33 @@ struct mmap2_event { char filename[PATH_MAX]; }; -struct comm_event { +struct perf_record_comm { struct perf_event_header header; __u32 pid, tid; char comm[16]; }; -struct namespaces_event { +struct perf_record_namespaces { struct perf_event_header header; __u32 pid, tid; __u64 nr_namespaces; struct perf_ns_link_info link_info[]; }; -struct fork_event { +struct perf_record_fork { struct perf_event_header header; __u32 pid, ppid; __u32 tid, ptid; __u64 time; }; -struct lost_event { +struct perf_record_lost { struct perf_event_header header; __u64 id; __u64 lost; }; -struct lost_samples_event { +struct perf_record_lost_samples { struct perf_event_header header; __u64 lost; }; @@ -65,7 +65,7 @@ struct lost_samples_event { /* * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID */ -struct read_event { +struct perf_record_read { struct perf_event_header header; __u32 pid, tid; __u64 value; @@ -74,7 +74,7 @@ struct read_event { __u64 id; }; -struct throttle_event { +struct perf_record_throttle { struct perf_event_header header; __u64 time; __u64 id; @@ -85,7 +85,7 @@ struct throttle_event { #define KSYM_NAME_LEN 256 #endif -struct ksymbol_event { +struct perf_record_ksymbol { struct perf_event_header header; __u64 addr; __u32 len; @@ -94,7 +94,7 @@ struct ksymbol_event { char name[KSYM_NAME_LEN]; }; -struct bpf_event { +struct perf_record_bpf_event { struct perf_event_header header; __u16 type; __u16 flags; @@ -104,7 +104,7 @@ struct bpf_event { __u8 tag[BPF_TAG_SIZE]; // prog tag }; -struct sample_event { +struct perf_record_sample { struct perf_event_header header; __u64 array[]; }; diff --git a/tools/perf/tests/parse-no-sample-id-all.c b/tools/perf/tests/parse-no-sample-id-all.c index 396e40d68922..8284752a60c8 100644 --- a/tools/perf/tests/parse-no-sample-id-all.c +++ b/tools/perf/tests/parse-no-sample-id-all.c @@ -87,10 +87,10 @@ int test__parse_no_sample_id_all(struct test *test __maybe_unused, int subtest _ }, .id = 2, }; - struct mmap_event event3 = { + struct perf_record_mmap event3 = { .header = { .type = PERF_RECORD_MMAP, - .size = sizeof(struct mmap_event), + .size = sizeof(struct perf_record_mmap), }, }; union perf_event *events[] = { diff --git a/tools/perf/util/bpf-event.c b/tools/perf/util/bpf-event.c index 5c634bcfea7e..3be8c480fa1f 100644 --- a/tools/perf/util/bpf-event.c +++ b/tools/perf/util/bpf-event.c @@ -161,8 +161,8 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, union perf_event *event, struct record_opts *opts) { - struct ksymbol_event *ksymbol_event = &event->ksymbol_event; - struct bpf_event *bpf_event = &event->bpf_event; + struct perf_record_ksymbol *ksymbol_event = &event->ksymbol_event; + struct perf_record_bpf_event *bpf_event = &event->bpf_event; struct bpf_prog_info_linear *info_linear; struct perf_tool *tool = session->tool; struct bpf_prog_info_node *info_node; @@ -230,10 +230,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, __u64 *prog_addrs = (__u64 *)(uintptr_t)(info->jited_ksyms); int name_len; - *ksymbol_event = (struct ksymbol_event){ + *ksymbol_event = (struct perf_record_ksymbol) { .header = { .type = PERF_RECORD_KSYMBOL, - .size = offsetof(struct ksymbol_event, name), + .size = offsetof(struct perf_record_ksymbol, name), }, .addr = prog_addrs[i], .len = prog_lens[i], @@ -254,10 +254,10 @@ static int perf_event__synthesize_one_bpf_prog(struct perf_session *session, if (!opts->no_bpf_event) { /* Synthesize PERF_RECORD_BPF_EVENT */ - *bpf_event = (struct bpf_event){ + *bpf_event = (struct perf_record_bpf_event) { .header = { .type = PERF_RECORD_BPF_EVENT, - .size = sizeof(struct bpf_event), + .size = sizeof(struct perf_record_bpf_event), }, .type = PERF_BPF_EVENT_PROG_LOAD, .flags = 0, diff --git a/tools/perf/util/event.h b/tools/perf/util/event.h index dee0ee57efc2..25f5309a3442 100644 --- a/tools/perf/util/event.h +++ b/tools/perf/util/event.h @@ -305,18 +305,18 @@ static inline void *perf_synth__raw_data(void *p) * when possible sends this number in a PERF_RECORD_LOST event. The number of * such "chunks" of lost events is stored in .nr_events[PERF_EVENT_LOST] while * total_lost tells exactly how many events the kernel in fact lost, i.e. it is - * the sum of all struct lost_event.lost fields reported. + * the sum of all struct perf_record_lost.lost fields reported. * * The kernel discards mixed up samples and sends the number in a * PERF_RECORD_LOST_SAMPLES event. The number of lost-samples events is stored * in .nr_events[PERF_RECORD_LOST_SAMPLES] while total_lost_samples tells * exactly how many samples the kernel in fact dropped, i.e. it is the sum of - * all struct lost_samples_event.lost fields reported. + * all struct perf_record_lost_samples.lost fields reported. * * The total_period is needed because by default auto-freq is used, so * multipling nr_events[PERF_EVENT_SAMPLE] by a frequency isn't possible to get * the total number of low level events, it is necessary to to sum all struct - * sample_event.period and stash the result in total_period. + * perf_record_sample.period and stash the result in total_period. */ struct events_stats { u64 total_period; @@ -550,16 +550,18 @@ struct compressed_event { union perf_event { struct perf_event_header header; - struct mmap_event mmap; - struct mmap2_event mmap2; - struct comm_event comm; - struct namespaces_event namespaces; - struct fork_event fork; - struct lost_event lost; - struct lost_samples_event lost_samples; - struct read_event read; - struct throttle_event throttle; - struct sample_event sample; + struct perf_record_mmap mmap; + struct perf_record_mmap2 mmap2; + struct perf_record_comm comm; + struct perf_record_namespaces namespaces; + struct perf_record_fork fork; + struct perf_record_lost lost; + struct perf_record_lost_samples lost_samples; + struct perf_record_read read; + struct perf_record_throttle throttle; + struct perf_record_sample sample; + struct perf_record_bpf_event bpf_event; + struct perf_record_ksymbol ksymbol_event; struct attr_event attr; struct event_update_event event_update; struct event_type_event event_type; @@ -579,8 +581,6 @@ union perf_event { struct stat_round_event stat_round; struct time_conv_event time_conv; struct feature_event feat; - struct ksymbol_event ksymbol_event; - struct bpf_event bpf_event; struct compressed_event pack; }; diff --git a/tools/perf/util/evsel.c b/tools/perf/util/evsel.c index 778262f68d5c..b3cfe120d097 100644 --- a/tools/perf/util/evsel.c +++ b/tools/perf/util/evsel.c @@ -117,7 +117,7 @@ int __perf_evsel__sample_size(u64 sample_type) * * This function returns the position of the event id (PERF_SAMPLE_ID or * PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of struct - * sample_event. + * perf_record_sample. */ static int __perf_evsel__calc_id_pos(u64 sample_type) { @@ -2420,7 +2420,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel, size_t perf_event__sample_event_size(const struct perf_sample *sample, u64 type, u64 read_format) { - size_t sz, result = sizeof(struct sample_event); + size_t sz, result = sizeof(struct perf_record_sample); if (type & PERF_SAMPLE_IDENTIFIER) result += sizeof(u64); diff --git a/tools/perf/util/evsel.h b/tools/perf/util/evsel.h index 5a351cae66df..77e07f2486d3 100644 --- a/tools/perf/util/evsel.h +++ b/tools/perf/util/evsel.h @@ -107,7 +107,7 @@ struct xyarray; * show the name used, not some alias. * @id_pos: the position of the event id (PERF_SAMPLE_ID or * PERF_SAMPLE_IDENTIFIER) in a sample event i.e. in the array of - * struct sample_event + * struct perf_record_sample * @is_pos: the position (counting backwards) of the event id (PERF_SAMPLE_ID or * PERF_SAMPLE_IDENTIFIER) in a non-sample event i.e. if sample_id_all * is used there is an id sample appended to non-sample events diff --git a/tools/perf/util/intel-bts.c b/tools/perf/util/intel-bts.c index 7eb9e6dc27dd..8dc6408206b9 100644 --- a/tools/perf/util/intel-bts.c +++ b/tools/perf/util/intel-bts.c @@ -818,7 +818,7 @@ static int intel_bts_synth_events(struct intel_bts *bts, * We only use sample types from PERF_SAMPLE_MASK so we can use * __perf_evsel__sample_size() here. */ - bts->branches_event_size = sizeof(struct sample_event) + + bts->branches_event_size = sizeof(struct perf_record_sample) + __perf_evsel__sample_size(attr.sample_type); } diff --git a/tools/perf/util/namespaces.c b/tools/perf/util/namespaces.c index 46d3a7754897..99be15dd2b6b 100644 --- a/tools/perf/util/namespaces.c +++ b/tools/perf/util/namespaces.c @@ -19,7 +19,7 @@ #include #include -struct namespaces *namespaces__new(struct namespaces_event *event) +struct namespaces *namespaces__new(struct perf_record_namespaces *event) { struct namespaces *namespaces; u64 link_info_size = ((event ? event->nr_namespaces : NR_NAMESPACES) * diff --git a/tools/perf/util/namespaces.h b/tools/perf/util/namespaces.h index 004430c0de93..40edef56cb52 100644 --- a/tools/perf/util/namespaces.h +++ b/tools/perf/util/namespaces.h @@ -17,7 +17,7 @@ int setns(int fd, int nstype); #endif -struct namespaces_event; +struct perf_record_namespaces; struct namespaces { struct list_head list; @@ -25,7 +25,7 @@ struct namespaces { struct perf_ns_link_info link_info[]; }; -struct namespaces *namespaces__new(struct namespaces_event *event); +struct namespaces *namespaces__new(struct perf_record_namespaces *event); void namespaces__free(struct namespaces *namespaces); struct nsinfo { diff --git a/tools/perf/util/python.c b/tools/perf/util/python.c index d21e270c7823..59974e901232 100644 --- a/tools/perf/util/python.c +++ b/tools/perf/util/python.c @@ -116,12 +116,12 @@ static PyMemberDef pyrf_mmap_event__members[] = { sample_members member_def(perf_event_header, type, T_UINT, "event type"), member_def(perf_event_header, misc, T_UINT, "event misc"), - member_def(mmap_event, pid, T_UINT, "event pid"), - member_def(mmap_event, tid, T_UINT, "event tid"), - member_def(mmap_event, start, T_ULONGLONG, "start of the map"), - member_def(mmap_event, len, T_ULONGLONG, "map length"), - member_def(mmap_event, pgoff, T_ULONGLONG, "page offset"), - member_def(mmap_event, filename, T_STRING_INPLACE, "backing store"), + member_def(perf_record_mmap, pid, T_UINT, "event pid"), + member_def(perf_record_mmap, tid, T_UINT, "event tid"), + member_def(perf_record_mmap, start, T_ULONGLONG, "start of the map"), + member_def(perf_record_mmap, len, T_ULONGLONG, "map length"), + member_def(perf_record_mmap, pgoff, T_ULONGLONG, "page offset"), + member_def(perf_record_mmap, filename, T_STRING_INPLACE, "backing store"), { .name = NULL, }, }; @@ -159,11 +159,11 @@ static char pyrf_task_event__doc[] = PyDoc_STR("perf task (fork/exit) event obje static PyMemberDef pyrf_task_event__members[] = { sample_members member_def(perf_event_header, type, T_UINT, "event type"), - member_def(fork_event, pid, T_UINT, "event pid"), - member_def(fork_event, ppid, T_UINT, "event ppid"), - member_def(fork_event, tid, T_UINT, "event tid"), - member_def(fork_event, ptid, T_UINT, "event ptid"), - member_def(fork_event, time, T_ULONGLONG, "timestamp"), + member_def(perf_record_fork, pid, T_UINT, "event pid"), + member_def(perf_record_fork, ppid, T_UINT, "event ppid"), + member_def(perf_record_fork, tid, T_UINT, "event tid"), + member_def(perf_record_fork, ptid, T_UINT, "event ptid"), + member_def(perf_record_fork, time, T_ULONGLONG, "timestamp"), { .name = NULL, }, }; @@ -194,9 +194,9 @@ static char pyrf_comm_event__doc[] = PyDoc_STR("perf comm event object."); static PyMemberDef pyrf_comm_event__members[] = { sample_members member_def(perf_event_header, type, T_UINT, "event type"), - member_def(comm_event, pid, T_UINT, "event pid"), - member_def(comm_event, tid, T_UINT, "event tid"), - member_def(comm_event, comm, T_STRING_INPLACE, "process name"), + member_def(perf_record_comm, pid, T_UINT, "event pid"), + member_def(perf_record_comm, tid, T_UINT, "event tid"), + member_def(perf_record_comm, comm, T_STRING_INPLACE, "process name"), { .name = NULL, }, }; @@ -223,15 +223,15 @@ static char pyrf_throttle_event__doc[] = PyDoc_STR("perf throttle event object." static PyMemberDef pyrf_throttle_event__members[] = { sample_members member_def(perf_event_header, type, T_UINT, "event type"), - member_def(throttle_event, time, T_ULONGLONG, "timestamp"), - member_def(throttle_event, id, T_ULONGLONG, "event id"), - member_def(throttle_event, stream_id, T_ULONGLONG, "event stream id"), + member_def(perf_record_throttle, time, T_ULONGLONG, "timestamp"), + member_def(perf_record_throttle, id, T_ULONGLONG, "event id"), + member_def(perf_record_throttle, stream_id, T_ULONGLONG, "event stream id"), { .name = NULL, }, }; static PyObject *pyrf_throttle_event__repr(struct pyrf_event *pevent) { - struct throttle_event *te = (struct throttle_event *)(&pevent->event.header + 1); + struct perf_record_throttle *te = (struct perf_record_throttle *)(&pevent->event.header + 1); return _PyUnicode_FromFormat("{ type: %sthrottle, time: %" PRI_lu64 ", id: %" PRI_lu64 ", stream_id: %" PRI_lu64 " }", @@ -253,8 +253,8 @@ static char pyrf_lost_event__doc[] = PyDoc_STR("perf lost event object."); static PyMemberDef pyrf_lost_event__members[] = { sample_members - member_def(lost_event, id, T_ULONGLONG, "event id"), - member_def(lost_event, lost, T_ULONGLONG, "number of lost events"), + member_def(perf_record_lost, id, T_ULONGLONG, "event id"), + member_def(perf_record_lost, lost, T_ULONGLONG, "number of lost events"), { .name = NULL, }, }; @@ -288,8 +288,8 @@ static char pyrf_read_event__doc[] = PyDoc_STR("perf read event object."); static PyMemberDef pyrf_read_event__members[] = { sample_members - member_def(read_event, pid, T_UINT, "event pid"), - member_def(read_event, tid, T_UINT, "event tid"), + member_def(perf_record_read, pid, T_UINT, "event pid"), + member_def(perf_record_read, tid, T_UINT, "event tid"), { .name = NULL, }, }; diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index cb1d8dcd0c19..4bfec9db36d6 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c @@ -1254,7 +1254,7 @@ static void dump_sample(struct evsel *evsel, union perf_event *event, static void dump_read(struct evsel *evsel, union perf_event *event) { - struct read_event *read_event = &event->read; + struct perf_record_read *read_event = &event->read; u64 read_format; if (!dump_trace) diff --git a/tools/perf/util/thread.c b/tools/perf/util/thread.c index bbf7816cba31..dbcb9cfb0f2f 100644 --- a/tools/perf/util/thread.c +++ b/tools/perf/util/thread.c @@ -169,7 +169,7 @@ struct namespaces *thread__namespaces(struct thread *thread) } static int __thread__set_namespaces(struct thread *thread, u64 timestamp, - struct namespaces_event *event) + struct perf_record_namespaces *event) { struct namespaces *new, *curr = __thread__namespaces(thread); @@ -193,7 +193,7 @@ static int __thread__set_namespaces(struct thread *thread, u64 timestamp, } int thread__set_namespaces(struct thread *thread, u64 timestamp, - struct namespaces_event *event) + struct perf_record_namespaces *event) { int ret; diff --git a/tools/perf/util/thread.h b/tools/perf/util/thread.h index bf06113be4f3..51bdb9a7af7f 100644 --- a/tools/perf/util/thread.h +++ b/tools/perf/util/thread.h @@ -16,7 +16,7 @@ struct addr_location; struct map; -struct namespaces_event; +struct perf_record_namespaces; struct thread_stack; struct unwind_libunwind_ops; @@ -74,7 +74,7 @@ static inline void thread__exited(struct thread *thread) struct namespaces *thread__namespaces(struct thread *thread); int thread__set_namespaces(struct thread *thread, u64 timestamp, - struct namespaces_event *event); + struct perf_record_namespaces *event); int __thread__set_comm(struct thread *thread, const char *comm, u64 timestamp, bool exec); -- cgit