libperf: Add events to perf/event.h
Jiri Olsa
reviewercover libperf: Add events to perf/event.h
hi,
as a preparation for sampling libperf interface, moving event definitions into the library header. Moving just the kernel non-AUX events now.
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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
It's also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixes
thanks,
jirka
---
Jiri Olsa (12):
libperf: Add mmap_event to perf/event.h
libperf: Add mmap2_event to perf/event.h
libperf: Add comm_event to perf/event.h
libperf: Add namespaces_event to perf/event.h
libperf: Add fork_event to perf/event.h
libperf: Add lost_event to perf/event.h
libperf: Add lost_samples_event to perf/event.h
libperf: Add read_event to perf/event.h
libperf: Add throttle_event to perf/event.h
libperf: Add ksymbol_event to perf/event.h
libperf: Add bpf_event to perf/event.h
libperf: Add sample_event to perf/event.h
tools/perf/builtin-sched.c | 2 +- tools/perf/lib/include/perf/event.h | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/event.c | 12 ++++++------ tools/perf/util/event.h | 104 +++----------------------------------------------------------------------------------------------------- tools/perf/util/evlist.c | 2 +- tools/perf/util/evsel.c | 8 ++++---- tools/perf/util/machine.c | 4 ++-- tools/perf/util/python.c | 14 +++++++------- tools/perf/util/session.c | 8 ++++---- 9 files changed, 140 insertions(+), 126 deletions(-) create mode 100644 tools/perf/lib/include/perf/event.h
Jiri Olsa
reviewerPATCH 1/12 libperf: Add mmap_event to perf/event.h
Moving mmap_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- tools/perf/lib/include/perf/event.h | 18 ++++++++++++++++++ tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 11 +++-------- tools/perf/util/python.c | 4 ++-- 4 files changed, 24 insertions(+), 11 deletions(-) create mode 100644 tools/perf/lib/include/perf/event.h
tools/perf/lib/include/perf/event.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_EVENT_H +#define __LIBPERF_EVENT_H + +#include <linux/perf_event.h> +#include <linux/types.h> +#include <linux/limits.h> + +struct mmap_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 start; +__u64 len; +__u64 pgoff; +char filename[PATH_MAX ]; +}; + +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.c +1 -1
@@ -1353,7 +1353,7 @@ int perf_event__process_bpf_event(struct perf_tool *tool __maybe_unused,size_t perf_event__fprintf_mmap (union perf_event *event,FILE *fp) { - return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %c %s\n", + return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64 "]: %c %s\n", event->mmap.pid, event->mmap.tid, event->mmap.start, event->mmap.len, event->mmap.pgoff, (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x',
tools/perf/util/event.h +3 -8
@@ -7,19 +7,14 @@#include <linux/kernel.h> #include <linux/bpf.h> #include <linux/perf_event.h> +#include <perf/event.h> #include "../perf.h" #include "build-id.h" #include "perf_regs.h" -struct mmap_event { -struct perf_event_header header; -u32 pid, tid; -u64 start; -u64 len; -u64 pgoff; -char filename[PATH_MAX ]; -}; +#define PRI_lu64 "l" PRIu64 +#define PRI_lx64 "l" PRIx64struct mmap2_event {struct perf_event_header header;
tools/perf/util/python.c +2 -2
@@ -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,
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 2/12 libperf: Add mmap2_event to perf/event.h
In reply to Jiri OlsaMoving mmap2_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- tools/perf/lib/include/perf/event.h | 15 +++++++++++++++ tools/perf/util/event.c | 6 +++--- tools/perf/util/event.h | 15 --------------- 3 files changed, 18 insertions(+), 18 deletions(-)
tools/perf/lib/include/perf/event.h +15 -0
@@ -15,4 +15,19 @@ struct mmap_event { char filename[PATH_MAX]; }; +struct mmap2_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 start; +__u64 len; +__u64 pgoff; +__u32 maj; +__u32 min; +__u64 ino; +__u64 ino_generation; +__u32 prot; +__u32 flags; +char filename[PATH_MAX ]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.c +3 -3
@@ -387,7 +387,7 @@ int perf_event__synthesize_mmap_events(struct perf_tool *tool,strcpy (execname,"" );/* 00400000-0040c000 r-xp 00000000 fd:01 41038 /bin/cat */ - n = sscanf(bf, "%"PRIx64"-%"PRIx64" %s %"PRIx64" %x:%x %u %[^\n]\n", + n = sscanf(bf, "%"PRI_lx64"-%"PRI_lx64" %s %"PRI_lx64" %x:%x %u %[^\n]\n", &event->mmap2.start, &event->mmap2.len, prot, &event->mmap2.pgoff, &event->mmap2.maj, &event->mmap2.min,
@@ -1362,8 +1362,8 @@ size_t perf_event__fprintf_mmap(union perf_event *event, FILE *fp)size_t perf_event__fprintf_mmap2 (union perf_event *event,FILE *fp) { - return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 - " %02x:%02x %"PRIu64" %"PRIu64"]: %c%c%c%c %s\n", + return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64 + " %02x:%02x %"PRI_lu64" %"PRI_lu64"]: %c%c%c%c %s\n", event->mmap2.pid, event->mmap2.tid, event->mmap2.start, event->mmap2.len, event->mmap2.pgoff, event->mmap2.maj, event->mmap2.min, event->mmap2.ino,
tools/perf/util/event.h +0 -15
@@ -16,21 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -struct mmap2_event { -struct perf_event_header header; -u32 pid, tid; -u64 start; -u64 len; -u64 pgoff; -u32 maj; -u32 min; -u64 ino; -u64 ino_generation; -u32 prot; -u32 flags; -char filename[PATH_MAX ]; -}; -struct comm_event {struct perf_event_header header;u32 pid, tid;
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 4/12 libperf: Add namespaces_event to perf/event.h
In reply to Jiri OlsaMoving namespaces_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.
--- tools/perf/lib/include/perf/event.h | 7 +++++++ tools/perf/util/event.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
tools/perf/lib/include/perf/event.h +7 -0
@@ -36,4 +36,11 @@ struct comm_event { char comm[16]; }; +struct namespaces_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 nr_namespaces; +struct perf_ns_link_info link_info[]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -7
@@ -16,13 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -struct namespaces_event { -struct perf_event_header header; -u32 pid, tid; -u64 nr_namespaces; -struct perf_ns_link_info link_info[]; -}; -struct fork_event {struct perf_event_header header;u32 pid, ppid;
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 5/12 libperf: Add fork_event to perf/event.h
In reply to Jiri OlsaMoving 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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- 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(-)
tools/perf/lib/include/perf/event.h +7 -0
@@ -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 */
tools/perf/util/event.h +0 -7
@@ -16,13 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -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;
tools/perf/util/python.c +1 -1
@@ -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,
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 3/12 libperf: Add comm_event to perf/event.h
In reply to Jiri OlsaMoving comm_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.
--- tools/perf/lib/include/perf/event.h | 6 ++++++ tools/perf/util/event.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/lib/include/perf/event.h +6 -0
@@ -30,4 +30,10 @@ struct mmap2_event { char filename[PATH_MAX]; }; +struct comm_event { +struct perf_event_header header; +__u32 pid, tid; +char comm[16 ]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -6
@@ -16,12 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -struct comm_event { -struct perf_event_header header; -u32 pid, tid; -char comm[16 ]; -}; -struct namespaces_event {struct perf_event_header header;u32 pid, tid;
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 7/12 libperf: Add lost_samples_event to perf/event.h
In reply to Jiri OlsaMoving lost_samples_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- tools/perf/lib/include/perf/event.h | 5 +++++ tools/perf/util/event.h | 5 ----- tools/perf/util/machine.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/lib/include/perf/event.h +5 -0
@@ -56,4 +56,9 @@ struct lost_event { __u64 lost; }; +struct lost_samples_event { +struct perf_event_header header; +__u64 lost; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -5
@@ -16,11 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -struct lost_samples_event { -struct perf_event_header header; -u64 lost; -}; -/* * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID */
tools/perf/util/machine.c +1 -1
@@ -650,7 +650,7 @@ int machine__process_lost_event(struct machine *machine __maybe_unused,int machine__process_lost_samples_event (struct machine *machine__maybe_unused ,union perf_event *event,struct perf_sample *sample) { -dump_printf (": id:%" PRIu64": lost samples :%" PRIu64"\n" , +dump_printf (": id:%" PRIu64": lost samples :%" PRI_lu64"\n" , sample->id, event->lost_samples.lost);return 0 ; }
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 9/12 libperf: Add throttle_event to perf/event.h
In reply to Jiri OlsaMoving throttle_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- 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(-)
tools/perf/lib/include/perf/event.h +7 -0
@@ -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 */
tools/perf/util/event.h +0 -7
@@ -16,13 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -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
tools/perf/util/python.c +2 -2
@@ -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); }
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 10/12 libperf: Add ksymbol_event to perf/event.h
In reply to Jiri OlsaMoving ksymbol_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- tools/perf/lib/include/perf/event.h | 13 +++++++++++++ tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 13 ------------- 3 files changed, 14 insertions(+), 14 deletions(-)
tools/perf/lib/include/perf/event.h +13 -0
@@ -80,4 +80,17 @@ struct throttle_event { __u64 stream_id; }; +#ifndef KSYM_NAME_LEN +#define KSYM_NAME_LEN 256 +#endif + +struct ksymbol_event { +struct perf_event_header header; +__u64 addr; +__u32 len; +__u16 ksym_type; +__u16 flags; +char name[KSYM_NAME_LEN ]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.c +1 -1
@@ -1485,7 +1485,7 @@ static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp)size_t perf_event__fprintf_ksymbol (union perf_event *event,FILE *fp) { -return fprintf (fp," addr %" PRIx64" len %u type %u flags 0x%x name %s\n" , +return fprintf (fp," addr %" PRI_lx64" len %u type %u flags 0x%x name %s\n" , event->ksymbol_event.addr, event->ksymbol_event.len, event->ksymbol_event.ksym_type, event->ksymbol_event.flags, event->ksymbol_event.name);
tools/perf/util/event.h +0 -13
@@ -16,19 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -#ifndef KSYM_NAME_LEN -#define KSYM_NAME_LEN 256 -#endif - -struct ksymbol_event { -struct perf_event_header header; -u64 addr; -u32 len; -u16 ksym_type; -u16 flags; -char name[KSYM_NAME_LEN ]; -}; -struct bpf_event {struct perf_event_header header;u16 type;
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 11/12 libperf: Add bpf_event to perf/event.h
In reply to Jiri OlsaMoving lost_samples_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.
--- tools/perf/lib/include/perf/event.h | 11 +++++++++++ tools/perf/util/event.h | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-)
tools/perf/lib/include/perf/event.h +11 -0
@@ -5,6 +5,7 @@#include <linux/perf_event.h> #include <linux/types.h> #include <linux/limits.h> +#include <linux/bpf.h> struct mmap_event {struct perf_event_header header;
@@ -93,4 +94,14 @@ struct ksymbol_event { char name[KSYM_NAME_LEN]; }; +struct bpf_event { +struct perf_event_header header; +__u16 type; +__u16 flags; +__u32 id; + +/* for bpf_prog types */ +__u8 tag[BPF_TAG_SIZE ];// prog tag +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -10
@@ -16,16 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -struct bpf_event { -struct perf_event_header header; -u16 type; -u16 flags; -u32 id; - -/* for bpf_prog types */ -u8 tag[BPF_TAG_SIZE ];// prog tag -}; -#define PERF_SAMPLE_MASK \ (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 12/12 libperf: Add sample_event to perf/event.h
In reply to Jiri OlsaMoving sample_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.
--- tools/perf/lib/include/perf/event.h | 5 +++++ tools/perf/util/event.h | 5 ----- tools/perf/util/evlist.c | 2 +- tools/perf/util/evsel.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-)
tools/perf/lib/include/perf/event.h +5 -0
@@ -104,4 +104,9 @@ struct bpf_event { __u8 tag[BPF_TAG_SIZE]; // prog tag }; +struct sample_event { +struct perf_event_header header; +__u64 array[]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -5
@@ -26,11 +26,6 @@/* perf sample has 16 bits size limit */ #define PERF_SAMPLE_MAX_SIZE (1 << 16) -struct sample_event { -struct perf_event_header header; -u64 array[]; -}; -struct regs_dump {u64 abi;u64 mask;
tools/perf/util/evlist.c +1 -1
@@ -587,7 +587,7 @@ struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,static int perf_evlist__event2id (struct evlist *evlist,union perf_event *event,u64 *id) { -const u64 *array = event->sample.array; +const __u64 *array = event->sample.array;ssize_t n; n = (event->header.size -sizeof (event->header)) >>3 ;
tools/perf/util/evsel.c +4 -4
@@ -2008,7 +2008,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel, struct perf_sample *sample) {u64 type = evsel->core.attr.sample_type; -const u64 *array = event->sample.array; +const __u64 *array = event->sample.array;bool swapped = evsel->needs_swap;union u64_swap u;
@@ -2098,7 +2098,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event, {u64 type = evsel->core.attr.sample_type;bool swapped = evsel->needs_swap; -const u64 *array; +const __u64 *array;u16 max_size = event->header.size;const void *endp = (void *)event + max_size;u64 sz;
@@ -2377,7 +2377,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel, u64 *timestamp) {u64 type = evsel->core.attr.sample_type; -const u64 *array; +const __u64 *array;if (!(type &PERF_SAMPLE_TIME ))return -1 ;
@@ -2528,7 +2528,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,u64 read_format, const struct perf_sample *sample) { - u64 *array; + __u64 *array;size_t sz;/* * used for cross-endian analysis. See git commit 65014ab3
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 8/12 libperf: Add read_event to perf/event.h
In reply to Jiri OlsaMoving read_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- tools/perf/lib/include/perf/event.h | 12 ++++++++++++ tools/perf/util/event.h | 12 ------------ tools/perf/util/session.c | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-)
tools/perf/lib/include/perf/event.h +12 -0
@@ -61,4 +61,16 @@ struct lost_samples_event { __u64 lost; }; +/* +* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID +*/ +struct read_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 value; +__u64 time_enabled; +__u64 time_running; +__u64 id; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -12
@@ -16,18 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -/* -* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID -*/ -struct read_event { -struct perf_event_header header; -u32 pid, tid; -u64 value; -u64 time_enabled; -u64 time_running; -u64 id; -}; -struct throttle_event {struct perf_event_header header;u64 time;
tools/perf/util/session.c +4 -4
@@ -1260,7 +1260,7 @@ static void dump_read(struct evsel *evsel, union perf_event *event)if (!dump_trace)return ; -printf (": %d %d %s %" PRIu64"\n" , event->read.pid, event->read.tid, +printf (": %d %d %s %" PRI_lu64"\n" , event->read.pid, event->read.tid,perf_evsel__name (evsel), event->read.value);
@@ -1270,13 +1270,13 @@ static void dump_read(struct evsel *evsel, union perf_event *event) read_format = evsel->core.attr.read_format;if (read_format &PERF_FORMAT_TOTAL_TIME_ENABLED ) -printf ("... time enabled : %" PRIu64"\n" , read_event->time_enabled); +printf ("... time enabled : %" PRI_lu64"\n" , read_event->time_enabled);if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) -printf ("... time running : %" PRIu64"\n" , read_event->time_running); +printf ("... time running : %" PRI_lu64"\n" , read_event->time_running);if (read_format &PERF_FORMAT_ID ) -printf ("... id : %" PRIu64"\n" , read_event->id); +printf ("... id : %" PRI_lu64"\n" , read_event->id); } static struct machine *machines__find_for_cpumode(struct machines *machines,
Signature · 1 line
2.21.0
Jiri Olsa
reviewerPATCH 6/12 libperf: Add lost_event to perf/event.h
In reply to Jiri OlsaMoving lost_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;
*/
Adding and using new PRI_lu64 and PRI_lx64 macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
--- 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(-)
tools/perf/builtin-sched.c +1 -1
@@ -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 ; }
tools/perf/lib/include/perf/event.h +6 -0
@@ -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 */
tools/perf/util/event.c +1 -1
@@ -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)
tools/perf/util/event.h +0 -6
@@ -16,12 +16,6 @@#define PRI_lu64 "l" PRIu64#define PRI_lx64 "l" PRIx64 -struct lost_event { -struct perf_event_header header; -u64 id; -u64 lost; -}; -struct lost_samples_event {struct perf_event_header header;u64 lost;
tools/perf/util/machine.c +1 -1
@@ -642,7 +642,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 ; }
tools/perf/util/python.c +2 -2
@@ -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 {
Signature · 1 line
2.21.0
Em Sun, Aug 25, 2019 at 08:17:40PM +0200, Jiri Olsa escreveu:
Quoted 16 lines
hi,
as a preparation for sampling libperf interface, moving event definitions into the library header. Moving just the kernel non-AUX events now.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
__u64values as stated in thelinux/types.hcomment:/*
* We define u64 asuint64_tfor every architecture
* so that we can print it with "%"PRIx64 without getting warnings. *
* typedef__u64u64;
Quoted 6 lines
* typedef __s64 s64; */Adding and using new
PRI_lu64andPRI_lx64macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
I think we should take advantage of this moment to rename those structs to have the 'perf_record_' prefix on them, I guess we could even remove the _event from them, i.e.:
'struct mmap_event' becomes 'perf_record_mmap', as it is the description for the PERF_RECORD_MMAP meta-data event, are you ok with that?
I can go ahead and do it myself, updating each patch on this series to do that.
- Arnaldo
Quoted 34 lines
It's also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixesthanks,
jirka---
Jiri Olsa (12):
libperf: Addmmap_eventtoperf/event.h
libperf: Addmmap2_eventtoperf/event.h
libperf: Addcomm_eventtoperf/event.h
libperf: Addnamespaces_eventtoperf/event.h
libperf: Addfork_eventtoperf/event.h
libperf: Addlost_eventtoperf/event.h
libperf: Addlost_samples_eventtoperf/event.h
libperf: Addread_eventtoperf/event.h
libperf: Addthrottle_eventtoperf/event.h
libperf: Addksymbol_eventtoperf/event.h
libperf: Addbpf_eventtoperf/event.h
libperf: Addsample_eventtoperf/event.htools/perf/builtin-sched.c | 2 +- tools/perf/lib/include/perf/event.h | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/event.c | 12 ++++++------ tools/perf/util/event.h | 104 +++----------------------------------------------------------------------------------------------------- tools/perf/util/evlist.c | 2 +- tools/perf/util/evsel.c | 8 ++++---- tools/perf/util/machine.c | 4 ++-- tools/perf/util/python.c | 14 +++++++------- tools/perf/util/session.c | 8 ++++---- 9 files changed, 140 insertions(+), 126 deletions(-) create mode 100644 tools/perf/lib/include/perf/event.h
Signature · 1 line
- Arnaldo
Em Sun, Aug 25, 2019 at 08:17:40PM +0200, Jiri Olsa escreveu:
Quoted 16 lines
hi,
as a preparation for sampling libperf interface, moving event definitions into the library header. Moving just the kernel non-AUX events now.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
__u64values as stated in thelinux/types.hcomment:/*
* We define u64 asuint64_tfor every architecture
* so that we can print it with "%"PRIx64 without getting warnings. *
* typedef__u64u64;
Quoted 6 lines
* typedef __s64 s64; */Adding and using new
PRI_lu64andPRI_lx64macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
So, this is not building on android env:
builtin-sched.c: In function 'process_lost':
builtin-sched.c:2646:2: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
^
builtin-sched.c:2646:2: error: format '%d' expects argument of type 'int', but argument 2 has type '__u64' [-Werror=format=] builtin-sched.c:2646:2: error: too many arguments for format [-Werror=format-extra-args]
MKDIR /tmp/build/perf/util/
[perfbuilder@490c2c7bdaab ~]$ /opt/android-ndk-r12b//toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc -v
Using built-in specs.
COLLECT_GCC=/opt/android-ndk-r12b//toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.9.x/lto-wrapper
Target: arm-linux-androideabi
Configured with: /usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --with-sysroot=/tmp/59719db9ae19ff43aef46bbcb79596b6/sysroot --with-binutils-version=2.25 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/59719db9ae19ff43aef46bbcb79596b6/include/c++/4.9.x --with-bugurl=http://source.android.com/source/report-bugs.html --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --with-arch=armv5te --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=default Thread model: posix
gcc version 4.9.x 20150123 (prerelease) (GCC)
[perfbuilder@490c2c7bdaab ~]$
It doesn't build on the r15b as well.
I'll investigate after lunch.
- Arnaldo
Quoted 34 lines
It's also available in here:
git://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
perf/fixesthanks,
jirka---
Jiri Olsa (12):
libperf: Addmmap_eventtoperf/event.h
libperf: Addmmap2_eventtoperf/event.h
libperf: Addcomm_eventtoperf/event.h
libperf: Addnamespaces_eventtoperf/event.h
libperf: Addfork_eventtoperf/event.h
libperf: Addlost_eventtoperf/event.h
libperf: Addlost_samples_eventtoperf/event.h
libperf: Addread_eventtoperf/event.h
libperf: Addthrottle_eventtoperf/event.h
libperf: Addksymbol_eventtoperf/event.h
libperf: Addbpf_eventtoperf/event.h
libperf: Addsample_eventtoperf/event.htools/perf/builtin-sched.c | 2 +- tools/perf/lib/include/perf/event.h | 112 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ tools/perf/util/event.c | 12 ++++++------ tools/perf/util/event.h | 104 +++----------------------------------------------------------------------------------------------------- tools/perf/util/evlist.c | 2 +- tools/perf/util/evsel.c | 8 ++++---- tools/perf/util/machine.c | 4 ++-- tools/perf/util/python.c | 14 +++++++------- tools/perf/util/session.c | 8 ++++---- 9 files changed, 140 insertions(+), 126 deletions(-) create mode 100644 tools/perf/lib/include/perf/event.h
Signature · 1 line
- Arnaldo
Em Mon, Aug 26, 2019 at 01:06:28PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 45 lines
Em Sun, Aug 25, 2019 at 08:17:40PM +0200, Jiri Olsa escreveu:
Quoted 16 lines
hi,
as a preparation for sampling libperf interface, moving event definitions into the library header. Moving just the kernel non-AUX events now.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
__u64values as stated in thelinux/types.hcomment:/*
* We define u64 asuint64_tfor every architecture
* so that we can print it with "%"PRIx64 without getting warnings. *
* typedef__u64u64;Quoted 6 lines
* typedef __s64 s64; */Adding and using new
PRI_lu64andPRI_lx64macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.So, this is not building on android env:
builtin-sched.c: In function 'process_lost':
builtin-sched.c:2646:2: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
^
builtin-sched.c:2646:2: error: format '%d' expects argument of type 'int', but argument 2 has type '__u64' [-Werror=format=] builtin-sched.c:2646:2: error: too many arguments for format [-Werror=format-extra-args]
MKDIR/tmp/build/perf/util/[perfbuilder@490c2c7bdaab ~]$
/opt/android-ndk-r12b//toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc-v
Using built-in specs.
COLLECT_GCC=/opt/android-ndk-r12b//toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/arm-linux-androideabi-gcc
COLLECT_LTO_WRAPPER=/opt/android-ndk-r12b/toolchains/arm-linux-androideabi-4.9/prebuilt/linux-x86_64/bin/../libexec/gcc/arm-linux-androideabi/4.9.x/lto-wrapper
Target: arm-linux-androideabi
Configured with:/usr/local/google/buildbot/src/android/gcc/toolchain/build/../gcc/gcc-4.9/configure--prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --target=arm-linux-androideabi --host=x86_64-linux-gnu --build=x86_64-linux-gnu --with-gnu-as --with-gnu-ld --enable-languages=c,c++ --with-gmp=/buildbot/tmp/build/toolchain/temp-install --with-mpfr=/buildbot/tmp/build/toolchain/temp-install --with-mpc=/buildbot/tmp/build/toolchain/temp-install --with-cloog=/buildbot/tmp/build/toolchain/temp-install --with-isl=/buildbot/tmp/build/toolchain/temp-install --with-ppl=/buildbot/tmp/build/toolchain/temp-install --disable-ppl-version-check --disable-cloog-version-check --disable-isl-version-check --enable-cloog-backend=isl --with-host-libstdcxx='-static-libgcc -Wl,-Bstatic,-lstdc++,-Bdynamic -lm' --disable-libssp --enable-threads --disable-nls --disable-libmudflap --disable-libgomp --disable-libstdc__-v3 --disable-sjlj-exceptions --disable-shared --disable-tls --disable-libitm --with-float=soft --with-fpu=vfp --with-arch=armv5te --enable-target-optspace --enable-bionic-libs --enable-libatomic-ifuncs=no --enable-initfini-array --disable-nls --prefix=/tmp/59719db9ae19ff43aef46bbcb79596b6 --with-sysroot=/tmp/59719db9ae19ff43aef46bbcb79596b6/sysroot --with-binutils-version=2.25 --with-mpfr-version=3.1.1 --with-mpc-version=1.0.1 --with-gmp-version=5.0.5 --with-gcc-version=4.9 --with-gdb-version=none --with-gxx-include-dir=/tmp/59719db9ae19ff43aef46bbcb79596b6/include/c++/4.9.x --with-bugurl=http://source.android.com/source/report-bugs.html --enable-languages=c,c++ --disable-bootstrap --enable-plugins --enable-libgomp --enable-gnu-indirect-function --disable-libsanitizer --enable-gold --enable-threads --enable-eh-frame-hdr-for-static --enable-graphite=yes --with-isl-version=0.11.1 --with-cloog-version=0.18.0 --with-arch=armv5te --program-transform-name='s&^&arm-linux-androideabi-&' --enable-gold=default Thread model: posix
gcc version 4.9.x 20150123 (prerelease) (GCC)
[perfbuilder@490c2c7bdaab ~]$
Quoted 3 lines
It doesn't build on the r15b as well.
I'll investigate after lunch.
$ make $EXTRA_MAKE_ARGS ARCH=$ARCH CROSS_COMPILE=$CROSS_COMPILE EXTRA_CFLAGS="$EXTRA_CFLAGS" -C /git/perf/tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i
We end up with one 'l' too many?
[perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost' /tmp/build/perf/builtin-sched.i
printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
[perfbuilder@490c2c7bdaab ~]$
And if we do this on a fedora:30 x86_64:
$ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i
[acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i
printf("lost %" "l"
# 2646 "builtin-sched.c" 3 4
"l" "u"
# 2646 "builtin-sched.c"
" events on cpu %d\n", event->lost.lost, sample->cpu);
[acme@quaco perf]$I.e. on 32-bit arches we shouldn't add that extra "l", right?
I bet the build for the mips/mipsel will fail too, lemme see... Yeah, both failed:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mips builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
^~~~~~~~
In file included from builtin-sched.c:31:
/usr/mips-linux-gnu/include/inttypes.h:47:28: note: format string is defined here
# define __PRI64_PREFIX "ll"
^[root@quaco ~]#
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mipsel builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
^~~~~~~~
In file included from builtin-sched.c:31:
/usr/mipsel-linux-gnu/include/inttypes.h:47:28: note: format string is defined here
# define __PRI64_PREFIX "ll"
^[root@quaco ~]#
And also on a uclibc ARC arch container:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/fedora\:24-x-ARC-uClibc builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu);
^~~~~~~~
In file included from builtin-sched.c:31:0:
/arc_gnu_2017.09-rc2_prebuilt_uclibc_le_arc700_linux_install/arc-snps-linux-uclibc/sysroot/usr/include/inttypes.h:47:28: note: format string is defined here
# define __PRI64_PREFIX "ll"
^[root@quaco ~]#
The _fix_ will come after lunch :)
- Arnaldo
Quoted 24 lines · Arnaldo Carvalho de Melo
Em Sun, Aug 25, 2019 at 08:17:40PM +0200, Jiri Olsa escreveu:
Quoted 16 lines
hi,
as a preparation for sampling libperf interface, moving event definitions into the library header. Moving just the kernel non-AUX events now.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
__u64values as stated in thelinux/types.hcomment:/*
* We define u64 asuint64_tfor every architecture
* so that we can print it with "%"PRIx64 without getting warnings. *
* typedef__u64u64;Quoted 6 lines
* typedef __s64 s64; */Adding and using new
PRI_lu64andPRI_lx64macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.
Quoted 6 lines
I think we should take advantage of this moment to rename those structs to have the '
perf_record_' prefix on them, I guess we could even remove the_eventfrom them, i.e.:'struct
mmap_event' becomes 'perf_record_mmap', as it is the description for thePERF_RECORD_MMAPmeta-data event, are you ok with that?
hum, not sure about loosing the '_event' here, but we are not public yet, so we can always change back ;-) I do like it'd follow the enum name
Quoted 2 lines
I can go ahead and do it myself, updating each patch on this series to do that.
sure, I thought we'd do it later, but feel free to do it, maybe in separate changes?
thanks,
jirka
On Mon, Aug 26, 2019 at 01:18:49PM -0300, Arnaldo Carvalho de Melo wrote:
SNIP
Quoted 15 lines
[perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost'
/tmp/build/perf/builtin-sched.i
printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
[perfbuilder@490c2c7bdaab ~]$And if we do this on a fedora:30
x86_64:$ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i [acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i printf("lost %" "l" # 2646 "builtin-sched.c" 3 4 "l" "u" # 2646 "builtin-sched.c" " events on cpu %d\n", event->lost.lost, sample->cpu); [acme@quaco perf]$
Quoted 1 line
I.e. on 32-bit arches we shouldn't add that extra "l", right?
hum, I guess we could #ifdef it 64/32 bits
Quoted 35 lines
I bet the build for the mips/mipsel will fail too, lemme see... Yeah, both failed:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mips builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31: /usr/mips-linux-gnu/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^[root@quaco ~]#
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mipsel builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31: /usr/mipsel-linux-gnu/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^[root@quaco ~]#
And also on a uclibc ARC arch container:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/fedora\:24-x-ARC-uClibc builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31:0: /arc_gnu_2017.09-rc2_prebuilt_uclibc_le_arc700_linux_install/arc-snps-linux-uclibc/sysroot/usr/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^
Quoted 3 lines
[root@quaco ~]#
The _fix_ will come after lunch :)
thanks ;-)
jirka
Em Mon, Aug 26, 2019 at 06:47:34PM +0200, Jiri Olsa escreveu:
Quoted 29 lines · Arnaldo Carvalho de Melo
Quoted 28 lines
Em Sun, Aug 25, 2019 at 08:17:40PM +0200, Jiri Olsa escreveu:
Quoted 16 lines
hi,
as a preparation for sampling libperf interface, moving event definitions into the library header. Moving just the kernel non-AUX events now.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
__u64values as stated in thelinux/types.hcomment:/*
* We define u64 asuint64_tfor every architecture
* so that we can print it with "%"PRIx64 without getting warnings. *
* typedef__u64u64;Quoted 6 lines
* typedef __s64 s64; */Adding and using new
PRI_lu64andPRI_lx64macros to be used for that. Using extra '_' to ease up the reading and differentiate them from standard PRI*64 macros.I think we should take advantage of this moment to rename those structs to have the '
perf_record_' prefix on them, I guess we could even remove the_eventfrom them, i.e.:
Quoted 6 lines
Quoted 2 lines
'struct
mmap_event' becomes 'perf_record_mmap', as it is the description for thePERF_RECORD_MMAPmeta-data event, are you ok with that?hum, not sure about loosing the '
_event' here, but we are not public yet, so we can always change back ;-) I do like it'd follow the enum name
So I'm making the already exported to libperf to be renamed to have the same name as the PERF_RECORD_ enum they map to, just all lowercase.
Looks nice and also makes something exported by libperf to have a perf_ namespace prefix.
BTW: you forgot to move PERF_RECORD_CONTEXT_SWITCH :-)
Quoted 5 lines
Quoted 2 lines
I can go ahead and do it myself, updating each patch on this series to do that.
sure, I thought we'd do it later, but feel free to do it, maybe in separate changes?
I did it as a separate patch, one patch for all the PERF_RECORD_ already moved to libperf.
Also some other minor stuff, like having that perf_event.{bpf,ksymbol}_event renamed to play perf_event.{bpf,ksymbol}, like the other records. so to make this idiom more compact and less redundant:
event->bpf_event
becomes:
event->bpf
ditto for ksymbol_event.
- Arnaldo
Em Mon, Aug 26, 2019 at 06:58:52PM +0200, Jiri Olsa escreveu:
Quoted 19 lines · Arnaldo Carvalho de Melo
SNIP
Quoted 15 lines
[perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost'
/tmp/build/perf/builtin-sched.i
printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
[perfbuilder@490c2c7bdaab ~]$And if we do this on a fedora:30
x86_64:$ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i [acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i printf("lost %" "l" # 2646 "builtin-sched.c" 3 4 "l" "u" # 2646 "builtin-sched.c" " events on cpu %d\n", event->lost.lost, sample->cpu); [acme@quaco perf]$
Quoted 3 lines
Quoted 1 line
I.e. on 32-bit arches we shouldn't add that extra "l", right?
hum, I guess we could #ifdef it 64/32 bits
I tried to figure out how to fix this better, but the int-ll64.h versus int-l64.h versus how __u64 is defined got me confused and I ended up with:
#if __WORDSIZE == 64
/*
* /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining
* __u64 as long long unsigned int, and then -Werror=format= kicks in and
* complains of the mismatched types, so use these two special extra PRI
* macros to overcome that.
*/
#define PRI_lu64 "l" PRIu64
#define PRI_lx64 "l" PRIx64
#else
#define PRI_lu64 PRIu64
#define PRI_lx64 PRIx64
#endif
Builds in all the containers I have, 32-bit, 64-bit, old gccs/clangs, new ones, uclibc, musl libc, glibc, etc
Quoted 42 lines
Quoted 35 lines
I bet the build for the mips/mipsel will fail too, lemme see... Yeah, both failed:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mips builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31: /usr/mips-linux-gnu/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^[root@quaco ~]#
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mipsel builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31: /usr/mipsel-linux-gnu/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^[root@quaco ~]#
And also on a uclibc ARC arch container:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/fedora\:24-x-ARC-uClibc builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31:0: /arc_gnu_2017.09-rc2_prebuilt_uclibc_le_arc700_linux_install/arc-snps-linux-uclibc/sysroot/usr/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^Quoted 3 lines
[root@quaco ~]#
The _fix_ will come after lunch :)
thanks ;-)
jirka
Signature · 1 line
- Arnaldo
Em Mon, Aug 26, 2019 at 07:14:19PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 22 lines
Em Mon, Aug 26, 2019 at 06:58:52PM +0200, Jiri Olsa escreveu:
Quoted 21 lines · Arnaldo Carvalho de Melo
SNIP
Quoted 16 lines
[perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost'
/tmp/build/perf/builtin-sched.i
printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
[perfbuilder@490c2c7bdaab ~]$And if we do this on a fedora:30
x86_64:$ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i [acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i printf("lost %" "l" # 2646 "builtin-sched.c" 3 4 "l" "u" # 2646 "builtin-sched.c" " events on cpu %d\n", event->lost.lost, sample->cpu); [acme@quaco perf]$I.e. on 32-bit arches we shouldn't add that extra "l", right?
Quoted 7 lines
Quoted 1 line
hum, I guess we could #ifdef it 64/32 bits
I tried to figure out how to fix this better, but the
int-ll64.hversusint-l64.hversus how__u64is defined got me confused and I ended up with:#if
__WORDSIZE== 64
Make that:
#ifdef __LP64__ to build on Alpine/musl libc.
- Arnaldo
Quoted 62 lines
/*
*/usr/include/inttypes.huses just 'lu' for PRIu64, but we end up defining
*__u64as long long unsigned int, and then -Werror=format= kicks in and
* complains of the mismatched types, so use these two special extra PRI
* macros to overcome that.
*/
#definePRI_lu64"l" PRIu64
#definePRI_lx64"l" PRIx64
#else
#definePRI_lu64PRIu64
#definePRI_lx64PRIx64
#endifBuilds in all the containers I have, 32-bit, 64-bit, old gccs/clangs, new ones, uclibc, musl libc, glibc, etc
Quoted 42 lines
Quoted 35 lines
I bet the build for the mips/mipsel will fail too, lemme see... Yeah, both failed:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mips builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31: /usr/mips-linux-gnu/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^[root@quaco ~]#
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/debian\:experimental-x-mipsel builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31: /usr/mipsel-linux-gnu/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^[root@quaco ~]#
And also on a uclibc ARC arch container:
[root@quaco ~]# grep -m1 -A6 -- -Werror=format= dm.log/fedora\:24-x-ARC-uClibc builtin-sched.c:2646:9: error: unknown conversion type character 'l' in format [-Werror=format=]
printf("lost %" PRI_lu64 " events on cpu %d\n", event->lost.lost, sample->cpu); ^~~~~~~~ In file included from builtin-sched.c:31:0: /arc_gnu_2017.09-rc2_prebuilt_uclibc_le_arc700_linux_install/arc-snps-linux-uclibc/sysroot/usr/include/inttypes.h:47:28: note: format string is defined here # define __PRI64_PREFIX "ll" ^Quoted 3 lines
[root@quaco ~]#
The _fix_ will come after lunch :)
thanks ;-)
jirka
Signature · 1 line
- Arnaldo
Signature · 1 line
- Arnaldo
Quoted 29 lines · Arnaldo Carvalho de Melo
Em Mon, Aug 26, 2019 at 07:14:19PM -0300, Arnaldo Carvalho de Melo escreveu:
Quoted 28 lines
Em Mon, Aug 26, 2019 at 06:58:52PM +0200, Jiri Olsa escreveu:
Quoted 19 lines · Arnaldo Carvalho de Melo
SNIP
Quoted 15 lines
[perfbuilder@490c2c7bdaab ~]$ grep 'printf("lost'
/tmp/build/perf/builtin-sched.i
printf("lost %" "l" "ll""u" " events on cpu %d\n", event->lost.lost, sample->cpu);
[perfbuilder@490c2c7bdaab ~]$And if we do this on a fedora:30
x86_64:$ make -C tools/perf O=/tmp/build/perf /tmp/build/perf/builtin-sched.i [acme@quaco perf]$ grep -A4 'printf("lost' /tmp/build/perf/builtin-sched.i printf("lost %" "l" # 2646 "builtin-sched.c" 3 4 "l" "u" # 2646 "builtin-sched.c" " events on cpu %d\n", event->lost.lost, sample->cpu); [acme@quaco perf]$Quoted 3 lines
Quoted 1 line
I.e. on 32-bit arches we shouldn't add that extra "l", right?
hum, I guess we could #ifdef it 64/32 bits
I tried to figure out how to fix this better, but the
int-ll64.hversusint-l64.hversus how__u64is defined got me confused and I ended up with:
Quoted 5 lines
Quoted 1 line
#if
__WORDSIZE== 64Make that:
#ifdef
__LP64__to build on Alpine/musl libc.
awesome, thanks ;-)
jirka
[tip: perf/core] libperf: Add PERF_RECORD_LOST 'struct lost_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 5290ed6955ebc481d5cd62f7175e8514931058bc Gitweb: https://git.kernel.org/tip/5290ed6955ebc481d5cd62f7175e8514931058bc Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:46 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:09 -03:00
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.
--- 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(-)
tools/perf/builtin-sched.c +1 -1
@@ -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 ; }
tools/perf/lib/include/perf/event.h +6 -0
@@ -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 */
tools/perf/util/event.c +1 -1
@@ -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)
tools/perf/util/event.h +0 -6
@@ -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;
tools/perf/util/machine.c +1 -1
@@ -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 ; }
tools/perf/util/python.c +2 -2
@@ -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 {
[tip: perf/core] libperf: Add PERF_RECORD_KSYMBOL 'struct ksymbol_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: f15e3c25a1b40794a0ef2647360afe873fe34f54 Gitweb: https://git.kernel.org/tip/f15e3c25a1b40794a0ef2647360afe873fe34f54 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:50 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:10 -03:00
libperf: Add PERF_RECORD_KSYMBOL 'struct ksymbol_event' to perf/event.h
Move the PERF_RECORD_KSYMBOL 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.
--- tools/perf/lib/include/perf/event.h | 13 +++++++++++++ tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 13 ------------- 3 files changed, 14 insertions(+), 14 deletions(-)
tools/perf/lib/include/perf/event.h +13 -0
@@ -80,4 +80,17 @@ struct throttle_event { __u64 stream_id; }; +#ifndef KSYM_NAME_LEN +#define KSYM_NAME_LEN 256 +#endif + +struct ksymbol_event { +struct perf_event_header header; +__u64 addr; +__u32 len; +__u16 ksym_type; +__u16 flags; +char name[KSYM_NAME_LEN ]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.c +1 -1
@@ -1485,7 +1485,7 @@ static size_t perf_event__fprintf_lost(union perf_event *event, FILE *fp)size_t perf_event__fprintf_ksymbol (union perf_event *event,FILE *fp) { -return fprintf (fp," addr %" PRIx64" len %u type %u flags 0x%x name %s\n" , +return fprintf (fp," addr %" PRI_lx64" len %u type %u flags 0x%x name %s\n" , event->ksymbol_event.addr, event->ksymbol_event.len, event->ksymbol_event.ksym_type, event->ksymbol_event.flags, event->ksymbol_event.name);
tools/perf/util/event.h +0 -13
@@ -27,19 +27,6 @@#define PRI_lx64 PRIx64#endif -#ifndef KSYM_NAME_LEN -#define KSYM_NAME_LEN 256 -#endif - -struct ksymbol_event { -struct perf_event_header header; -u64 addr; -u32 len; -u16 ksym_type; -u16 flags; -char name[KSYM_NAME_LEN ]; -}; -struct bpf_event {struct perf_event_header header;u16 type;
[tip: perf/core] libperf: Add PERF_RECORD_FORK 'struct fork_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: bceb59b1f28d1ca812d816fd8f33c72b1a8378fb Gitweb: https://git.kernel.org/tip/bceb59b1f28d1ca812d816fd8f33c72b1a8378fb Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:45 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:09 -03:00
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.
--- 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(-)
tools/perf/lib/include/perf/event.h +7 -0
@@ -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 */
tools/perf/util/event.h +0 -7
@@ -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;
tools/perf/util/python.c +1 -1
@@ -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,
[tip: perf/core] libperf: Add PERF_RECORD_SAMPLE 'struct sample_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: b1fcd190bb3fc1234dca60390d171a4cc75b21b2 Gitweb: https://git.kernel.org/tip/b1fcd190bb3fc1234dca60390d171a4cc75b21b2 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:52 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:10 -03:00
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.
--- tools/perf/lib/include/perf/event.h | 5 +++++ tools/perf/util/event.h | 5 ----- tools/perf/util/evlist.c | 2 +- tools/perf/util/evsel.c | 8 ++++---- 4 files changed, 10 insertions(+), 10 deletions(-)
tools/perf/lib/include/perf/event.h +5 -0
@@ -104,4 +104,9 @@ struct bpf_event { __u8 tag[BPF_TAG_SIZE]; // prog tag }; +struct sample_event { +struct perf_event_header header; +__u64 array[]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -5
@@ -37,11 +37,6 @@/* perf sample has 16 bits size limit */ #define PERF_SAMPLE_MAX_SIZE (1 << 16) -struct sample_event { -struct perf_event_header header; -u64 array[]; -}; -struct regs_dump {u64 abi;u64 mask;
tools/perf/util/evlist.c +1 -1
@@ -587,7 +587,7 @@ struct evsel *perf_evlist__id2evsel_strict(struct evlist *evlist,static int perf_evlist__event2id (struct evlist *evlist,union perf_event *event,u64 *id) { -const u64 *array = event->sample.array; +const __u64 *array = event->sample.array;ssize_t n; n = (event->header.size -sizeof (event->header)) >>3 ;
tools/perf/util/evsel.c +4 -4
@@ -2009,7 +2009,7 @@ static int perf_evsel__parse_id_sample(const struct evsel *evsel, struct perf_sample *sample) {u64 type = evsel->core.attr.sample_type; -const u64 *array = event->sample.array; +const __u64 *array = event->sample.array;bool swapped = evsel->needs_swap;union u64_swap u;
@@ -2099,7 +2099,7 @@ int perf_evsel__parse_sample(struct evsel *evsel, union perf_event *event, {u64 type = evsel->core.attr.sample_type;bool swapped = evsel->needs_swap; -const u64 *array; +const __u64 *array;u16 max_size = event->header.size;const void *endp = (void *)event + max_size;u64 sz;
@@ -2378,7 +2378,7 @@ int perf_evsel__parse_sample_timestamp(struct evsel *evsel, u64 *timestamp) {u64 type = evsel->core.attr.sample_type; -const u64 *array; +const __u64 *array;if (!(type &PERF_SAMPLE_TIME ))return -1 ;
@@ -2529,7 +2529,7 @@ int perf_event__synthesize_sample(union perf_event *event, u64 type,u64 read_format, const struct perf_sample *sample) { - u64 *array; + __u64 *array;size_t sz;/* * used for cross-endian analysis. See git commit 65014ab3
[tip: perf/core] libperf: Add PERF_RECORD_LOST_SAMPLES 'struct lost_samples_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: a2e254d84172f7eb638261a83024d849f78c89e9 Gitweb: https://git.kernel.org/tip/a2e254d84172f7eb638261a83024d849f78c89e9 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:47 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:10 -03:00
libperf: Add PERF_RECORD_LOST_SAMPLES 'struct lost_samples_event' to perf/event.h
Move the PERF_RECORD_LOST_SAMPLES 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.
--- tools/perf/lib/include/perf/event.h | 5 +++++ tools/perf/util/event.h | 5 ----- tools/perf/util/machine.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/lib/include/perf/event.h +5 -0
@@ -56,4 +56,9 @@ struct lost_event { __u64 lost; }; +struct lost_samples_event { +struct perf_event_header header; +__u64 lost; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -5
@@ -27,11 +27,6 @@#define PRI_lx64 PRIx64#endif -struct lost_samples_event { -struct perf_event_header header; -u64 lost; -}; -/* * PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID */
tools/perf/util/machine.c +1 -1
@@ -653,7 +653,7 @@ int machine__process_lost_event(struct machine *machine __maybe_unused,int machine__process_lost_samples_event (struct machine *machine__maybe_unused ,union perf_event *event,struct perf_sample *sample) { -dump_printf (": id:%" PRIu64": lost samples :%" PRIu64"\n" , +dump_printf (": id:%" PRIu64": lost samples :%" PRI_lu64"\n" , sample->id, event->lost_samples.lost);return 0 ; }
[tip: perf/core] libperf: Add PERF_RECORD_COMM 'struct comm_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 002dda32a831b30d22a3620eb619a0d103e78e81 Gitweb: https://git.kernel.org/tip/002dda32a831b30d22a3620eb619a0d103e78e81 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:43 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:09 -03:00
libperf: Add PERF_RECORD_COMM 'struct comm_event' to perf/event.h
Moving comm_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.
--- tools/perf/lib/include/perf/event.h | 6 ++++++ tools/perf/util/event.h | 6 ------ 2 files changed, 6 insertions(+), 6 deletions(-)
tools/perf/lib/include/perf/event.h +6 -0
@@ -30,4 +30,10 @@ struct mmap2_event { char filename[PATH_MAX]; }; +struct comm_event { +struct perf_event_header header; +__u32 pid, tid; +char comm[16 ]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -6
@@ -27,12 +27,6 @@#define PRI_lx64 PRIx64#endif -struct comm_event { -struct perf_event_header header; -u32 pid, tid; -char comm[16 ]; -}; -struct namespaces_event {struct perf_event_header header;u32 pid, tid;
[tip: perf/core] libperf: Add PERF_RECORD_READ 'struct read_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 213a6c1d20687d44acaa1cb4f77ce5bae4f1dd8f Gitweb: https://git.kernel.org/tip/213a6c1d20687d44acaa1cb4f77ce5bae4f1dd8f Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:48 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:10 -03:00
libperf: Add PERF_RECORD_READ 'struct read_event' to perf/event.h
Move the PERF_RECORD_READ 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.
--- tools/perf/lib/include/perf/event.h | 12 ++++++++++++ tools/perf/util/event.h | 12 ------------ tools/perf/util/session.c | 8 ++++---- 3 files changed, 16 insertions(+), 16 deletions(-)
tools/perf/lib/include/perf/event.h +12 -0
@@ -61,4 +61,16 @@ struct lost_samples_event { __u64 lost; }; +/* +* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID +*/ +struct read_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 value; +__u64 time_enabled; +__u64 time_running; +__u64 id; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -12
@@ -27,18 +27,6 @@#define PRI_lx64 PRIx64#endif -/* -* PERF_FORMAT_ENABLED | PERF_FORMAT_RUNNING | PERF_FORMAT_ID -*/ -struct read_event { -struct perf_event_header header; -u32 pid, tid; -u64 value; -u64 time_enabled; -u64 time_running; -u64 id; -}; -struct throttle_event {struct perf_event_header header;u64 time;
tools/perf/util/session.c +4 -4
@@ -1260,7 +1260,7 @@ static void dump_read(struct evsel *evsel, union perf_event *event)if (!dump_trace)return ; -printf (": %d %d %s %" PRIu64"\n" , event->read.pid, event->read.tid, +printf (": %d %d %s %" PRI_lu64"\n" , event->read.pid, event->read.tid,perf_evsel__name (evsel), event->read.value);
@@ -1270,13 +1270,13 @@ static void dump_read(struct evsel *evsel, union perf_event *event) read_format = evsel->core.attr.read_format;if (read_format &PERF_FORMAT_TOTAL_TIME_ENABLED ) -printf ("... time enabled : %" PRIu64"\n" , read_event->time_enabled); +printf ("... time enabled : %" PRI_lu64"\n" , read_event->time_enabled);if (read_format &PERF_FORMAT_TOTAL_TIME_RUNNING ) -printf ("... time running : %" PRIu64"\n" , read_event->time_running); +printf ("... time running : %" PRI_lu64"\n" , read_event->time_running);if (read_format &PERF_FORMAT_ID ) -printf ("... id : %" PRIu64"\n" , read_event->id); +printf ("... id : %" PRI_lu64"\n" , read_event->id); } static struct machine *machines__find_for_cpumode(struct machines *machines,
[tip: perf/core] libperf: Add PERF_RECORD_BPF_EVENT 'struct bpf_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: b1b510142283c02991f48b27d399852364f7d89b Gitweb: https://git.kernel.org/tip/b1b510142283c02991f48b27d399852364f7d89b Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:51 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:10 -03:00
libperf: Add PERF_RECORD_BPF_EVENT 'struct bpf_event' to perf/event.h
Move the PERF_RECORD_BPF_EVENT event definition to libperf's event.h.
In order to keep libperf simple, we switch 'u64/u32/u16/u8' types used events to their generic '__u*' versions.
--- tools/perf/lib/include/perf/event.h | 11 +++++++++++ tools/perf/util/event.h | 10 ---------- 2 files changed, 11 insertions(+), 10 deletions(-)
tools/perf/lib/include/perf/event.h +11 -0
@@ -5,6 +5,7 @@#include <linux/perf_event.h> #include <linux/types.h> #include <linux/limits.h> +#include <linux/bpf.h> struct mmap_event {struct perf_event_header header;
@@ -93,4 +94,14 @@ struct ksymbol_event { char name[KSYM_NAME_LEN]; }; +struct bpf_event { +struct perf_event_header header; +__u16 type; +__u16 flags; +__u32 id; + +/* for bpf_prog types */ +__u8 tag[BPF_TAG_SIZE ];// prog tag +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -10
@@ -27,16 +27,6 @@#define PRI_lx64 PRIx64#endif -struct bpf_event { -struct perf_event_header header; -u16 type; -u16 flags; -u32 id; - -/* for bpf_prog types */ -u8 tag[BPF_TAG_SIZE ];// prog tag -}; -#define PERF_SAMPLE_MASK \ (PERF_SAMPLE_IP | PERF_SAMPLE_TID | \ PERF_SAMPLE_TIME | PERF_SAMPLE_ADDR | \
[tip: perf/core] libperf: Add PERF_RECORD_THROTTLE 'struct throttle_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 003c66fec28fea52825b60cad98af8cf11074d76 Gitweb: https://git.kernel.org/tip/003c66fec28fea52825b60cad98af8cf11074d76 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:49 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:10 -03:00
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.
--- 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(-)
tools/perf/lib/include/perf/event.h +7 -0
@@ -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 */
tools/perf/util/event.h +0 -7
@@ -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
tools/perf/util/python.c +2 -2
@@ -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); }
[tip: perf/core] libperf: Add PERF_RECORD_MMAP 'struct mmap_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 1345e2ee87a83c758f336f03f7fb305bc5e24490 Gitweb: https://git.kernel.org/tip/1345e2ee87a83c758f336f03f7fb305bc5e24490 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:41 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:38:04 -03:00
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.
--- tools/perf/lib/include/perf/event.h | 18 ++++++++++++++++++ tools/perf/util/event.c | 2 +- tools/perf/util/event.h | 22 ++++++++++++++-------- tools/perf/util/python.c | 4 ++-- 4 files changed, 35 insertions(+), 11 deletions(-) create mode 100644 tools/perf/lib/include/perf/event.h
tools/perf/lib/include/perf/event.h new file +18 -0
@@ -0,0 +1,18 @@ +/* SPDX-License-Identifier: GPL-2.0 */ +#ifndef __LIBPERF_EVENT_H +#define __LIBPERF_EVENT_H + +#include <linux/perf_event.h> +#include <linux/types.h> +#include <linux/limits.h> + +struct mmap_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 start; +__u64 len; +__u64 pgoff; +char filename[PATH_MAX ]; +}; + +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.c +1 -1
@@ -1353,7 +1353,7 @@ int perf_event__process_bpf_event(struct perf_tool *tool __maybe_unused,size_t perf_event__fprintf_mmap (union perf_event *event,FILE *fp) { - return fprintf(fp, " %d/%d: [%#" PRIx64 "(%#" PRIx64 ") @ %#" PRIx64 "]: %c %s\n", + return fprintf(fp, " %d/%d: [%#" PRI_lx64 "(%#" PRI_lx64 ") @ %#" PRI_lx64 "]: %c %s\n", event->mmap.pid, event->mmap.tid, event->mmap.start, event->mmap.len, event->mmap.pgoff, (event->header.misc & PERF_RECORD_MISC_MMAP_DATA) ? 'r' : 'x',
tools/perf/util/event.h +14 -8
@@ -7,19 +7,25 @@#include <linux/kernel.h> #include <linux/bpf.h> #include <linux/perf_event.h> +#include <perf/event.h> #include "../perf.h" #include "build-id.h" #include "perf_regs.h" -struct mmap_event { -struct perf_event_header header; -u32 pid, tid; -u64 start; -u64 len; -u64 pgoff; -char filename[PATH_MAX ]; -}; +#ifdef __LP64__ +/* +* /usr/include/inttypes.h uses just 'lu' for PRIu64, but we end up defining +* __u64 as long long unsigned int, and then -Werror=format= kicks in and +* complains of the mismatched types, so use these two special extra PRI +* macros to overcome that. +*/ +#define PRI_lu64 "l" PRIu64 +#define PRI_lx64 "l" PRIx64 +#else +#define PRI_lu64 PRIu64 +#define PRI_lx64 PRIx64 +#endif struct mmap2_event {struct perf_event_header header;
tools/perf/util/python.c +2 -2
@@ -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,
[tip: perf/core] libperf: Add PERF_RECORD_NAMESPACES 'struct namespaces_event' to perf/event.h
In reply to Jiri OlsaThe following commit has been merged into the perf/core branch of tip:
The following commit has been merged into the perf/core branch of tip:
Commit-ID: 19d1765a3ed9a8f78d93909120f6d39398809f75 Gitweb: https://git.kernel.org/tip/19d1765a3ed9a8f78d93909120f6d39398809f75 Author: Jiri Olsa <[email protected]> AuthorDate: Sun, 25 Aug 2019 20:17:44 +02:00 Committer: Arnaldo Carvalho de Melo <[email protected]> CommitterDate: Mon, 26 Aug 2019 19:39:09 -03:00
libperf: Add PERF_RECORD_NAMESPACES 'struct namespaces_event' to perf/event.h
Move the namespaces_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.
--- tools/perf/lib/include/perf/event.h | 7 +++++++ tools/perf/util/event.h | 7 ------- 2 files changed, 7 insertions(+), 7 deletions(-)
tools/perf/lib/include/perf/event.h +7 -0
@@ -36,4 +36,11 @@ struct comm_event { char comm[16]; }; +struct namespaces_event { +struct perf_event_header header; +__u32 pid, tid; +__u64 nr_namespaces; +struct perf_ns_link_info link_info[]; +}; +#endif /* __LIBPERF_EVENT_H */
tools/perf/util/event.h +0 -7
@@ -27,13 +27,6 @@#define PRI_lx64 PRIx64#endif -struct namespaces_event { -struct perf_event_header header; -u32 pid, tid; -u64 nr_namespaces; -struct perf_ns_link_info link_info[]; -}; -struct fork_event {struct perf_event_header header;u32 pid, ppid;