Commit 4502d77c authored by Peter Zijlstra's avatar Peter Zijlstra Committed by Ingo Molnar

perf_counter tools: Small frequency related fixes

Create the counter in a disabled state and only enable it after we
mmap() the buffer, this allows us to see the first few samples (and
observe the frequency ramp).

Furthermore, print the period in the verbose report.
Signed-off-by: default avatarPeter Zijlstra <a.p.zijlstra@chello.nl>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Arnaldo Carvalho de Melo <acme@redhat.com>
LKML-Reference: <new-submission>
Signed-off-by: default avatarIngo Molnar <mingo@elte.hu>
parent bd2b5b12
...@@ -347,6 +347,7 @@ static void create_counter(int counter, int cpu, pid_t pid) ...@@ -347,6 +347,7 @@ static void create_counter(int counter, int cpu, pid_t pid)
attr->mmap = track; attr->mmap = track;
attr->comm = track; attr->comm = track;
attr->inherit = (cpu < 0) && inherit; attr->inherit = (cpu < 0) && inherit;
attr->disabled = 1;
track = 0; /* only the first counter needs these */ track = 0; /* only the first counter needs these */
...@@ -402,6 +403,8 @@ static void create_counter(int counter, int cpu, pid_t pid) ...@@ -402,6 +403,8 @@ static void create_counter(int counter, int cpu, pid_t pid)
error("failed to mmap with %d (%s)\n", errno, strerror(errno)); error("failed to mmap with %d (%s)\n", errno, strerror(errno));
exit(-1); exit(-1);
} }
ioctl(fd[nr_cpu][counter], PERF_COUNTER_IOC_ENABLE);
} }
static void open_counters(int cpu, pid_t pid) static void open_counters(int cpu, pid_t pid)
......
...@@ -47,6 +47,7 @@ struct ip_event { ...@@ -47,6 +47,7 @@ struct ip_event {
struct perf_event_header header; struct perf_event_header header;
__u64 ip; __u64 ip;
__u32 pid, tid; __u32 pid, tid;
__u64 period;
}; };
struct mmap_event { struct mmap_event {
...@@ -943,12 +944,13 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head) ...@@ -943,12 +944,13 @@ process_overflow_event(event_t *event, unsigned long offset, unsigned long head)
uint64_t ip = event->ip.ip; uint64_t ip = event->ip.ip;
struct map *map = NULL; struct map *map = NULL;
dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p\n", dprintf("%p [%p]: PERF_EVENT (IP, %d): %d: %p period: %Ld\n",
(void *)(offset + head), (void *)(offset + head),
(void *)(long)(event->header.size), (void *)(long)(event->header.size),
event->header.misc, event->header.misc,
event->ip.pid, event->ip.pid,
(void *)(long)ip); (void *)(long)ip,
(long long)event->ip.period);
dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid); dprintf(" ... thread: %s:%d\n", thread->comm, thread->pid);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment