mirror of https://gitee.com/openkylin/linux.git
perf tools: Factorize the event structure definitions in a single file
Factorize the multiple definition of the events structures into a single util/event.h file. Signed-off-by: Frederic Weisbecker <fweisbec@gmail.com> Cc: Arnaldo Carvalho de Melo <acme@redhat.com> Cc: Peter Zijlstra <peterz@infradead.org> Cc: Mike Galbraith <efault@gmx.de> Cc: Brice Goglin <Brice.Goglin@inria.fr>
This commit is contained in:
parent
cd84c2ac6d
commit
1fe2c1066c
|
@ -44,40 +44,6 @@ static int print_line;
|
|||
static unsigned long page_size;
|
||||
static unsigned long mmap_window = 32;
|
||||
|
||||
struct ip_event {
|
||||
struct perf_event_header header;
|
||||
u64 ip;
|
||||
u32 pid, tid;
|
||||
};
|
||||
|
||||
struct mmap_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, tid;
|
||||
u64 start;
|
||||
u64 len;
|
||||
u64 pgoff;
|
||||
char filename[PATH_MAX];
|
||||
};
|
||||
|
||||
struct comm_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, tid;
|
||||
char comm[16];
|
||||
};
|
||||
|
||||
struct fork_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, ppid;
|
||||
};
|
||||
|
||||
typedef union event_union {
|
||||
struct perf_event_header header;
|
||||
struct ip_event ip;
|
||||
struct mmap_event mmap;
|
||||
struct comm_event comm;
|
||||
struct fork_event fork;
|
||||
} event_t;
|
||||
|
||||
|
||||
struct sym_ext {
|
||||
struct rb_node node;
|
||||
|
|
|
@ -59,24 +59,6 @@ static int file_new = 1;
|
|||
|
||||
struct perf_header *header;
|
||||
|
||||
struct mmap_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid;
|
||||
u32 tid;
|
||||
u64 start;
|
||||
u64 len;
|
||||
u64 pgoff;
|
||||
char filename[PATH_MAX];
|
||||
};
|
||||
|
||||
struct comm_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid;
|
||||
u32 tid;
|
||||
char comm[16];
|
||||
};
|
||||
|
||||
|
||||
struct mmap_data {
|
||||
int counter;
|
||||
void *base;
|
||||
|
|
|
@ -75,59 +75,6 @@ struct callchain_param callchain_param = {
|
|||
|
||||
static u64 sample_type;
|
||||
|
||||
struct ip_event {
|
||||
struct perf_event_header header;
|
||||
u64 ip;
|
||||
u32 pid, tid;
|
||||
unsigned char __more_data[];
|
||||
};
|
||||
|
||||
struct mmap_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, tid;
|
||||
u64 start;
|
||||
u64 len;
|
||||
u64 pgoff;
|
||||
char filename[PATH_MAX];
|
||||
};
|
||||
|
||||
struct comm_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, tid;
|
||||
char comm[16];
|
||||
};
|
||||
|
||||
struct fork_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, ppid;
|
||||
u32 tid, ptid;
|
||||
};
|
||||
|
||||
struct lost_event {
|
||||
struct perf_event_header header;
|
||||
u64 id;
|
||||
u64 lost;
|
||||
};
|
||||
|
||||
struct read_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid,tid;
|
||||
u64 value;
|
||||
u64 time_enabled;
|
||||
u64 time_running;
|
||||
u64 id;
|
||||
};
|
||||
|
||||
typedef union event_union {
|
||||
struct perf_event_header header;
|
||||
struct ip_event ip;
|
||||
struct mmap_event mmap;
|
||||
struct comm_event comm;
|
||||
struct fork_event fork;
|
||||
struct lost_event lost;
|
||||
struct read_event read;
|
||||
} event_t;
|
||||
|
||||
static int repsep_fprintf(FILE *fp, const char *fmt, ...)
|
||||
{
|
||||
int n;
|
||||
|
|
|
@ -933,26 +933,6 @@ static void mmap_read_counter(struct mmap_data *md)
|
|||
last_read = this_read;
|
||||
|
||||
for (; old != head;) {
|
||||
struct ip_event {
|
||||
struct perf_event_header header;
|
||||
u64 ip;
|
||||
u32 pid, target_pid;
|
||||
};
|
||||
struct mmap_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, target_pid;
|
||||
u64 start;
|
||||
u64 len;
|
||||
u64 pgoff;
|
||||
char filename[PATH_MAX];
|
||||
};
|
||||
|
||||
typedef union event_union {
|
||||
struct perf_event_header header;
|
||||
struct ip_event ip;
|
||||
struct mmap_event mmap;
|
||||
} event_t;
|
||||
|
||||
event_t *event = (event_t *)&data[old & md->mask];
|
||||
|
||||
event_t event_copy;
|
||||
|
|
|
@ -0,0 +1,54 @@
|
|||
#include "../perf.h"
|
||||
|
||||
struct ip_event {
|
||||
struct perf_event_header header;
|
||||
u64 ip;
|
||||
u32 pid, tid;
|
||||
unsigned char __more_data[];
|
||||
};
|
||||
|
||||
struct mmap_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, tid;
|
||||
u64 start;
|
||||
u64 len;
|
||||
u64 pgoff;
|
||||
char filename[PATH_MAX];
|
||||
};
|
||||
|
||||
struct comm_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, tid;
|
||||
char comm[16];
|
||||
};
|
||||
|
||||
struct fork_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid, ppid;
|
||||
u32 tid, ptid;
|
||||
};
|
||||
|
||||
struct lost_event {
|
||||
struct perf_event_header header;
|
||||
u64 id;
|
||||
u64 lost;
|
||||
};
|
||||
|
||||
struct read_event {
|
||||
struct perf_event_header header;
|
||||
u32 pid,tid;
|
||||
u64 value;
|
||||
u64 time_enabled;
|
||||
u64 time_running;
|
||||
u64 id;
|
||||
};
|
||||
|
||||
typedef union event_union {
|
||||
struct perf_event_header header;
|
||||
struct ip_event ip;
|
||||
struct mmap_event mmap;
|
||||
struct comm_event comm;
|
||||
struct fork_event fork;
|
||||
struct lost_event lost;
|
||||
struct read_event read;
|
||||
} event_t;
|
|
@ -83,6 +83,8 @@
|
|||
#include <inttypes.h>
|
||||
#include "../../../include/linux/magic.h"
|
||||
|
||||
#include "event.h"
|
||||
|
||||
#ifndef NO_ICONV
|
||||
#include <iconv.h>
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue