aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPeter Zijlstra <a.p.zijlstra@chello.nl>2009-06-02 11:38:21 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-02 15:45:34 -0400
commitc70975bc8d5bac487616785f5d5bc7b090dfa2d9 (patch)
treedfbbd1e7af293dc41732fda240476598057df5ec
parent0d48696f87e3618b0d35bd3e4e9d7c188d51e7de (diff)
perf_counter tools: Fix up the ABI shakeup
Signed-off-by: Peter 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: Ingo Molnar <mingo@elte.hu>
-rw-r--r--Documentation/perf_counter/builtin-record.c18
-rw-r--r--Documentation/perf_counter/builtin-stat.c22
-rw-r--r--Documentation/perf_counter/builtin-top.c20
-rw-r--r--Documentation/perf_counter/perf.h4
4 files changed, 32 insertions, 32 deletions
diff --git a/Documentation/perf_counter/builtin-record.c b/Documentation/perf_counter/builtin-record.c
index bace7a8edf80..c2fd04244972 100644
--- a/Documentation/perf_counter/builtin-record.c
+++ b/Documentation/perf_counter/builtin-record.c
@@ -322,7 +322,7 @@ static void synthesize_events(void)
322 322
323static void open_counters(int cpu, pid_t pid) 323static void open_counters(int cpu, pid_t pid)
324{ 324{
325 struct perf_counter_hw_event hw_event; 325 struct perf_counter_attr attr;
326 int counter, group_fd; 326 int counter, group_fd;
327 int track = 1; 327 int track = 1;
328 328
@@ -334,18 +334,18 @@ static void open_counters(int cpu, pid_t pid)
334 group_fd = -1; 334 group_fd = -1;
335 for (counter = 0; counter < nr_counters; counter++) { 335 for (counter = 0; counter < nr_counters; counter++) {
336 336
337 memset(&hw_event, 0, sizeof(hw_event)); 337 memset(&attr, 0, sizeof(attr));
338 hw_event.config = event_id[counter]; 338 attr.config = event_id[counter];
339 hw_event.irq_period = event_count[counter]; 339 attr.sample_period = event_count[counter];
340 hw_event.record_type = PERF_RECORD_IP | PERF_RECORD_TID; 340 attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
341 hw_event.mmap = track; 341 attr.mmap = track;
342 hw_event.comm = track; 342 attr.comm = track;
343 hw_event.inherit = (cpu < 0) && inherit; 343 attr.inherit = (cpu < 0) && inherit;
344 344
345 track = 0; // only the first counter needs these 345 track = 0; // only the first counter needs these
346 346
347 fd[nr_cpu][counter] = 347 fd[nr_cpu][counter] =
348 sys_perf_counter_open(&hw_event, pid, cpu, group_fd, 0); 348 sys_perf_counter_open(&attr, pid, cpu, group_fd, 0);
349 349
350 if (fd[nr_cpu][counter] < 0) { 350 if (fd[nr_cpu][counter] < 0) {
351 int err = errno; 351 int err = errno;
diff --git a/Documentation/perf_counter/builtin-stat.c b/Documentation/perf_counter/builtin-stat.c
index 644f850b7bde..27abe6a2db3b 100644
--- a/Documentation/perf_counter/builtin-stat.c
+++ b/Documentation/perf_counter/builtin-stat.c
@@ -79,22 +79,22 @@ static __u64 walltime_nsecs;
79 79
80static void create_perfstat_counter(int counter) 80static void create_perfstat_counter(int counter)
81{ 81{
82 struct perf_counter_hw_event hw_event; 82 struct perf_counter_attr attr;
83 83
84 memset(&hw_event, 0, sizeof(hw_event)); 84 memset(&attr, 0, sizeof(attr));
85 hw_event.config = event_id[counter]; 85 attr.config = event_id[counter];
86 hw_event.record_type = 0; 86 attr.sample_type = 0;
87 hw_event.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL; 87 attr.exclude_kernel = event_mask[counter] & EVENT_MASK_KERNEL;
88 hw_event.exclude_user = event_mask[counter] & EVENT_MASK_USER; 88 attr.exclude_user = event_mask[counter] & EVENT_MASK_USER;
89 89
90 if (scale) 90 if (scale)
91 hw_event.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED | 91 attr.read_format = PERF_FORMAT_TOTAL_TIME_ENABLED |
92 PERF_FORMAT_TOTAL_TIME_RUNNING; 92 PERF_FORMAT_TOTAL_TIME_RUNNING;
93 93
94 if (system_wide) { 94 if (system_wide) {
95 int cpu; 95 int cpu;
96 for (cpu = 0; cpu < nr_cpus; cpu ++) { 96 for (cpu = 0; cpu < nr_cpus; cpu ++) {
97 fd[cpu][counter] = sys_perf_counter_open(&hw_event, -1, cpu, -1, 0); 97 fd[cpu][counter] = sys_perf_counter_open(&attr, -1, cpu, -1, 0);
98 if (fd[cpu][counter] < 0) { 98 if (fd[cpu][counter] < 0) {
99 printf("perfstat error: syscall returned with %d (%s)\n", 99 printf("perfstat error: syscall returned with %d (%s)\n",
100 fd[cpu][counter], strerror(errno)); 100 fd[cpu][counter], strerror(errno));
@@ -102,10 +102,10 @@ static void create_perfstat_counter(int counter)
102 } 102 }
103 } 103 }
104 } else { 104 } else {
105 hw_event.inherit = inherit; 105 attr.inherit = inherit;
106 hw_event.disabled = 1; 106 attr.disabled = 1;
107 107
108 fd[0][counter] = sys_perf_counter_open(&hw_event, 0, -1, -1, 0); 108 fd[0][counter] = sys_perf_counter_open(&attr, 0, -1, -1, 0);
109 if (fd[0][counter] < 0) { 109 if (fd[0][counter] < 0) {
110 printf("perfstat error: syscall returned with %d (%s)\n", 110 printf("perfstat error: syscall returned with %d (%s)\n",
111 fd[0][counter], strerror(errno)); 111 fd[0][counter], strerror(errno));
diff --git a/Documentation/perf_counter/builtin-top.c b/Documentation/perf_counter/builtin-top.c
index a2cff7b05276..5029d8e6cd9c 100644
--- a/Documentation/perf_counter/builtin-top.c
+++ b/Documentation/perf_counter/builtin-top.c
@@ -537,7 +537,7 @@ static void mmap_read(struct mmap_data *md)
537 old += size; 537 old += size;
538 538
539 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) { 539 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) {
540 if (event->header.type & PERF_RECORD_IP) 540 if (event->header.type & PERF_SAMPLE_IP)
541 process_event(event->ip.ip, md->counter); 541 process_event(event->ip.ip, md->counter);
542 } else { 542 } else {
543 switch (event->header.type) { 543 switch (event->header.type) {
@@ -563,7 +563,7 @@ static struct mmap_data mmap_array[MAX_NR_CPUS][MAX_COUNTERS];
563 563
564static int __cmd_top(void) 564static int __cmd_top(void)
565{ 565{
566 struct perf_counter_hw_event hw_event; 566 struct perf_counter_attr attr;
567 pthread_t thread; 567 pthread_t thread;
568 int i, counter, group_fd, nr_poll = 0; 568 int i, counter, group_fd, nr_poll = 0;
569 unsigned int cpu; 569 unsigned int cpu;
@@ -577,15 +577,15 @@ static int __cmd_top(void)
577 if (target_pid == -1 && profile_cpu == -1) 577 if (target_pid == -1 && profile_cpu == -1)
578 cpu = i; 578 cpu = i;
579 579
580 memset(&hw_event, 0, sizeof(hw_event)); 580 memset(&attr, 0, sizeof(attr));
581 hw_event.config = event_id[counter]; 581 attr.config = event_id[counter];
582 hw_event.irq_period = event_count[counter]; 582 attr.sample_period = event_count[counter];
583 hw_event.record_type = PERF_RECORD_IP | PERF_RECORD_TID; 583 attr.sample_type = PERF_SAMPLE_IP | PERF_SAMPLE_TID;
584 hw_event.mmap = use_mmap; 584 attr.mmap = use_mmap;
585 hw_event.munmap = use_munmap; 585 attr.munmap = use_munmap;
586 hw_event.freq = freq; 586 attr.freq = freq;
587 587
588 fd[i][counter] = sys_perf_counter_open(&hw_event, target_pid, cpu, group_fd, 0); 588 fd[i][counter] = sys_perf_counter_open(&attr, target_pid, cpu, group_fd, 0);
589 if (fd[i][counter] < 0) { 589 if (fd[i][counter] < 0) {
590 int err = errno; 590 int err = errno;
591 printf("kerneltop error: syscall returned with %d (%s)\n", 591 printf("kerneltop error: syscall returned with %d (%s)\n",
diff --git a/Documentation/perf_counter/perf.h b/Documentation/perf_counter/perf.h
index 5a2520bb7e55..10622a48b408 100644
--- a/Documentation/perf_counter/perf.h
+++ b/Documentation/perf_counter/perf.h
@@ -53,11 +53,11 @@ static inline unsigned long long rdclock(void)
53 _min1 < _min2 ? _min1 : _min2; }) 53 _min1 < _min2 ? _min1 : _min2; })
54 54
55static inline int 55static inline int
56sys_perf_counter_open(struct perf_counter_hw_event *hw_event_uptr, 56sys_perf_counter_open(struct perf_counter_attr *attr_uptr,
57 pid_t pid, int cpu, int group_fd, 57 pid_t pid, int cpu, int group_fd,
58 unsigned long flags) 58 unsigned long flags)
59{ 59{
60 return syscall(__NR_perf_counter_open, hw_event_uptr, pid, cpu, 60 return syscall(__NR_perf_counter_open, attr_uptr, pid, cpu,
61 group_fd, flags); 61 group_fd, flags);
62} 62}
63 63