aboutsummaryrefslogtreecommitdiffstats
path: root/Documentation/perf_counter/builtin-report.c
diff options
context:
space:
mode:
authorIngo Molnar <mingo@elte.hu>2009-06-05 12:07:51 -0400
committerIngo Molnar <mingo@elte.hu>2009-06-05 12:07:51 -0400
commitb2fef0762fdb65cf8702eea93f4e58abeb0ecefc (patch)
tree8f7c82a62a895f434e9817084f0c5210fd7b1f80 /Documentation/perf_counter/builtin-report.c
parent6a24ed6c6082ec65d19331a4bfa30c0512a1a822 (diff)
perf_counter tools: Sample and display frequency adjustment changes
To allow the debugging of frequency-adjusting counters, sample those adjustments and display them in perf report -D. Acked-by: Peter 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: Ingo Molnar <mingo@elte.hu>
Diffstat (limited to 'Documentation/perf_counter/builtin-report.c')
-rw-r--r--Documentation/perf_counter/builtin-report.c39
1 files changed, 33 insertions, 6 deletions
diff --git a/Documentation/perf_counter/builtin-report.c b/Documentation/perf_counter/builtin-report.c
index 5af105c280b5..242e09ff3658 100644
--- a/Documentation/perf_counter/builtin-report.c
+++ b/Documentation/perf_counter/builtin-report.c
@@ -69,12 +69,20 @@ struct fork_event {
69 __u32 pid, ppid; 69 __u32 pid, ppid;
70}; 70};
71 71
72typedef union event_union { 72struct period_event {
73 struct perf_event_header header; 73 struct perf_event_header header;
74 struct ip_event ip; 74 __u64 time;
75 struct mmap_event mmap; 75 __u64 id;
76 struct comm_event comm; 76 __u64 sample_period;
77 struct fork_event fork; 77};
78
79typedef union event_union {
80 struct perf_event_header header;
81 struct ip_event ip;
82 struct mmap_event mmap;
83 struct comm_event comm;
84 struct fork_event fork;
85 struct period_event period;
78} event_t; 86} event_t;
79 87
80static LIST_HEAD(dsos); 88static LIST_HEAD(dsos);
@@ -1053,6 +1061,19 @@ process_fork_event(event_t *event, unsigned long offset, unsigned long head)
1053} 1061}
1054 1062
1055static int 1063static int
1064process_period_event(event_t *event, unsigned long offset, unsigned long head)
1065{
1066 dprintf("%p [%p]: PERF_EVENT_PERIOD: time:%Ld, id:%Ld: period:%Ld\n",
1067 (void *)(offset + head),
1068 (void *)(long)(event->header.size),
1069 event->period.time,
1070 event->period.id,
1071 event->period.sample_period);
1072
1073 return 0;
1074}
1075
1076static int
1056process_event(event_t *event, unsigned long offset, unsigned long head) 1077process_event(event_t *event, unsigned long offset, unsigned long head)
1057{ 1078{
1058 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW) 1079 if (event->header.misc & PERF_EVENT_MISC_OVERFLOW)
@@ -1068,11 +1089,12 @@ process_event(event_t *event, unsigned long offset, unsigned long head)
1068 case PERF_EVENT_FORK: 1089 case PERF_EVENT_FORK:
1069 return process_fork_event(event, offset, head); 1090 return process_fork_event(event, offset, head);
1070 1091
1092 case PERF_EVENT_PERIOD:
1093 return process_period_event(event, offset, head);
1071 /* 1094 /*
1072 * We dont process them right now but they are fine: 1095 * We dont process them right now but they are fine:
1073 */ 1096 */
1074 1097
1075 case PERF_EVENT_PERIOD:
1076 case PERF_EVENT_THROTTLE: 1098 case PERF_EVENT_THROTTLE:
1077 case PERF_EVENT_UNTHROTTLE: 1099 case PERF_EVENT_UNTHROTTLE:
1078 return 0; 1100 return 0;
@@ -1157,6 +1179,11 @@ more:
1157 1179
1158 size = event->header.size; 1180 size = event->header.size;
1159 1181
1182 dprintf("%p [%p]: event: %d\n",
1183 (void *)(offset + head),
1184 (void *)(long)event->header.size,
1185 event->header.type);
1186
1160 if (!size || process_event(event, offset, head) < 0) { 1187 if (!size || process_event(event, offset, head) < 0) {
1161 1188
1162 dprintf("%p [%p]: skipping unknown header type: %d\n", 1189 dprintf("%p [%p]: skipping unknown header type: %d\n",