Skip to contentSkip to conversation

libperf: Rename the PERF_RECORD_ structs to have a "perf" suffix

tip: perf/core tip-bot2 for Arnaldo Carvalho de Melo 1 participant 1 message Aug 27, 2019 1 message not in the archive perf events

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

tip-bot2 for Arnaldo Carvalho de Melo

author merge bot Applied
#1 lore raw

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

Commit-ID:     69d81f09e1607b577346c0579bf938c1194bff3a
Gitweb:        https://git.kernel.org/tip/69d81f09e1607b577346c0579bf938c1194bff3a
Author:        Arnaldo Carvalho de Melo <[email protected]>
AuthorDate:    Mon, 26 Aug 2019 19:02:31 -03:00
Committer:     Arnaldo Carvalho de Melo <[email protected]>
CommitterDate: Mon, 26 Aug 2019 19:39:11 -03:00

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.

---
 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(-)
tools/perf/lib/include/perf/event.h +12 -12
index e768a2d..36ad3a4 100644
@@ -7,7 +7,7 @@
 #include <linux/limits.h>
 #include <linux/bpf.h>
 
-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[];
 };
tools/perf/tests/parse-no-sample-id-all.c +2 -2
index 396e40d..8284752 100644
@@ -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[] = {
tools/perf/util/bpf-event.c +6 -6
index 5c634bc..3be8c48 100644
@@ -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,
tools/perf/util/event.h +15 -15
index dee0ee5..25f5309 100644
@@ -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;
 };
 
tools/perf/util/evsel.c +2 -2
index 778262f..b3cfe12 100644
@@ -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);
tools/perf/util/evsel.h +1 -1
index 5a351ca..77e07f2 100644
@@ -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
tools/perf/util/intel-bts.c +1 -1
index 7eb9e6d..8dc6408 100644
@@ -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);
 	}
 
tools/perf/util/namespaces.c +1 -1
index 46d3a77..99be15d 100644
@@ -19,7 +19,7 @@
 #include <asm/bug.h>
 #include <linux/zalloc.h>
 
-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) *
tools/perf/util/namespaces.h +2 -2
index 004430c..40edef5 100644
@@ -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 {
tools/perf/util/python.c +22 -22

85 lines not on this page · raw message

tools/perf/util/session.c +1 -1
index cb1d8dc..4bfec9d 100644
@@ -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)
tools/perf/util/thread.c +2 -2
index bbf7816..dbcb9cf 100644
@@ -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;
 
tools/perf/util/thread.h +2 -2
index bf06113..51bdb9a 100644
@@ -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);