提交 c70975bc 编写于 作者: P Peter Zijlstra 提交者: Ingo Molnar

perf_counter tools: Fix up the ABI shakeup

Signed-off-by: NPeter Zijlstra <a.p.zijlstra@chello.nl>
LKML-Reference: <new-submission>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Corey Ashford <cjashfor@linux.vnet.ibm.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: John Kacur <jkacur@redhat.com>
Cc: Stephane Eranian <eranian@googlemail.com>
LKML-Reference: <new-submission>
Signed-off-by: NIngo Molnar <mingo@elte.hu>
上级 0d48696f
......@@ -322,7 +322,7 @@ static void synthesize_events(void)
static void open_counters(int cpu, pid_t pid)
{
struct perf_counter_hw_event hw_event;
struct perf_counter_attr attr;
int counter, group_fd;
int track = 1;
......@@ -334,18 +334,18 @@ static void open_counters(int cpu, pid_t pid)
group_fd = -1;
for (counter = 0; counter < nr_counters; counter++) {
memset(&hw_event, 0, sizeof(hw_event));
hw_event.config = event_id[counter];
hw_event.irq_period = event_count[counter];
hw_event.record_type = PERF_RECORD_IP | PERF_RECORD_TID;
hw_event.mmap = track;
hw_event.comm = track;
hw_event.inherit = (cpu < 0) && inherit;
memset(&attr, 0, sizeof(attr));
attr.config = event_id[counter];
attr.sample_period = event_count[counter];
attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
attr.mmap = track;
attr.comm = track;
attr.inherit = (cpu < 0) && inherit;
track = 0; // only the first counter needs these
fd[nr_cpu][counter] =
sys_perf_counter_open(&hw_event, pid, cpu, group_fd, 0);
sys_perf_counter_open(&attr, pid, cpu, group_fd, 0);
if (fd[nr_cpu][counter] < 0) {
int err = errno;
......
......@@ -79,22 +79,22 @@ static __u64 walltime_nsecs;
static void create_perfstat_counter(int counter)
{
struct perf_counter_hw_event hw_event;
struct perf_counter_attr attr;
memset(&hw_event, 0, sizeof(hw_event));
hw_event.config = event_id[counter];
hw_event.record_type = 0;
hw_event.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
hw_event.exclude_user = event_mask[counter] & EVENT_MASK_USER;
memset(&attr, 0, sizeof(attr));
attr.config = event_id[counter];
attr.sample_type = 0;
attr.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
attr.exclude_user = event_mask[counter] & EVENT_MASK_USER;
if (scale)
hw_event.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
PERF_FORMAT_TOTAL_TIME_RUNNING;
if (system_wide) {
int cpu;
for (cpu = 0; cpu < nr_cpus; cpu ++) {
fd[cpu][counter] = sys_perf_counter_open(&hw_event, -1, cpu, -1, 0);
fd[cpu][counter] = sys_perf_counter_open(&attr, -1, cpu, -1, 0);
if (fd[cpu][counter] < 0) {
printf("perfstat error: syscall returned with %d (%s)\n",
fd[cpu][counter], strerror(errno));
......@@ -102,10 +102,10 @@ static void create_perfstat_counter(int counter)
}
}
} else {
hw_event.inherit = inherit;
hw_event.disabled = 1;
attr.inherit = inherit;
attr.disabled = 1;
fd[0][counter] = sys_perf_counter_open(&hw_event, 0, -1, -1, 0);
fd[0][counter] = sys_perf_counter_open(&attr, 0, -1, -1, 0);
if (fd[0][counter] < 0) {
printf("perfstat error: syscall returned with %d (%s)\n",
fd[0][counter], strerror(errno));
......
......@@ -537,7 +537,7 @@ static void mmap_read(struct mmap_data *md)
old += size;
if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
if (event->header.type & PERF_RECORD_IP)
if (event->header.type & PERF_SAMPLE_IP)
process_event(event->ip.ip, md->counter);
} else {
switch (event->header.type) {
......@@ -563,7 +563,7 @@ static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
static int __cmd_top(void)
{
struct perf_counter_hw_event hw_event;
struct perf_counter_attr attr;
pthread_t thread;
int i, counter, group_fd, nr_poll = 0;
unsigned int cpu;
......@@ -577,15 +577,15 @@ static int __cmd_top(void)
if (target_pid == -1 && profile_cpu == -1)
cpu = i;
memset(&hw_event, 0, sizeof(hw_event));
hw_event.config = event_id[counter];
hw_event.irq_period = event_count[counter];
hw_event.record_type = PERF_RECORD_IP | PERF_RECORD_TID;
hw_event.mmap = use_mmap;
hw_event.munmap = use_munmap;
hw_event.freq = freq;
memset(&attr, 0, sizeof(attr));
attr.config = event_id[counter];
attr.sample_period = event_count[counter];
attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
attr.mmap = use_mmap;
attr.munmap = use_munmap;
attr.freq = freq;
fd[i][counter] = sys_perf_counter_open(&hw_event, target_pid, cpu, group_fd, 0);
fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
if (fd[i][counter] < 0) {
int err = errno;
printf("kerneltop error: syscall returned with %d (%s)\n",
......
......@@ -53,11 +53,11 @@ static inline unsigned long long rdclock(void)
_min1 < _min2 ? _min1 : _min2; })
static inline int
sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr,
sys_perf_counter_open(struct perf_counter_attr *attr_uptr,
pid_t pid, int cpu, int group_fd,
unsigned long flags)
{
return syscall(__NR_perf_counter_open, hw_event_uptr, pid, cpu,
return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu,
group_fd, flags);
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册