perf_counter tools: Fix up the ABI shakeup
Commit-ID: c70975bc8d5bac487616785f5d5bc7b090dfa2d9 Gitweb: http://git.kernel.org/tip/c70975bc8d5bac487616785f5d5bc7b090dfa2d9 Author: Peter Zijlstra <[email protected]> AuthorDate: Tue, 2 Jun 2009 17:38:21 +0200 Committer: Ingo Molnar <[email protected]> CommitDate: Tue, 2 Jun 2009 21:45:34 +0200
perf_counter tools: Fix up the ABI shakeup
Signed-off-by Peter Zijlstra <[email protected]>
LKML-Reference: <new-submission>
Cc: Mike Galbraith <[email protected]>
Cc: Paul Mackerras <[email protected]>
Cc: Corey Ashford <[email protected]>
Cc: Marcelo Tosatti <[email protected]>
Cc: Arnaldo Carvalho de Melo <[email protected]>
Cc: Thomas Gleixner <[email protected]>
Cc: John Kacur <[email protected]>
Cc: Stephane Eranian <[email protected]>
LKML-Reference: <new-submission>
Signed-off-by Ingo Molnar <[email protected]>
--- Documentation/perf_counter/builtin-record.c | 18 +++++++++--------- Documentation/perf_counter/builtin-stat.c | 22 +++++++++++----------- Documentation/perf_counter/builtin-top.c | 20 ++++++++++---------- Documentation/perf_counter/perf.h | 4 ++-- 4 files changed, 32 insertions(+), 32 deletions(-)
Documentation/perf_counter/builtin-record.c +9 -9
@@ -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;
Documentation/perf_counter/builtin-stat.c +11 -11
@@ -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));
Documentation/perf_counter/builtin-top.c +10 -10
@@ -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",
Documentation/perf_counter/perf.h +2 -2
@@ -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); }