diff options
author | Peter Zijlstra <a.p.zijlstra@chello.nl> | 2009-06-18 05:40:28 -0400 |
---|---|---|
committer | Ingo Molnar <mingo@elte.hu> | 2009-06-18 08:46:11 -0400 |
commit | 9d91a6f7a489eb914c16b82d927f9d81d629c259 (patch) | |
tree | efdccca4b54282bcc941fce5206778d6b0f8e49d /tools/perf/builtin-report.c | |
parent | 43a21ea81a2400992561146327c4785ce7f7be38 (diff) |
perf_counter tools: Handle lost events
Make use of the new ->data_tail mechanism to tell kernel-space
about user-space draining the data stream. Emit lost events
(and display them) if they happen.
Signed-off-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 'tools/perf/builtin-report.c')
-rw-r--r-- | tools/perf/builtin-report.c | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/tools/perf/builtin-report.c b/tools/perf/builtin-report.c index 9a3805f0c9f2..fe66895111b1 100644 --- a/tools/perf/builtin-report.c +++ b/tools/perf/builtin-report.c | |||
@@ -83,6 +83,12 @@ struct period_event { | |||
83 | __u64 sample_period; | 83 | __u64 sample_period; |
84 | }; | 84 | }; |
85 | 85 | ||
86 | struct lost_event { | ||
87 | struct perf_event_header header; | ||
88 | __u64 id; | ||
89 | __u64 lost; | ||
90 | }; | ||
91 | |||
86 | typedef union event_union { | 92 | typedef union event_union { |
87 | struct perf_event_header header; | 93 | struct perf_event_header header; |
88 | struct ip_event ip; | 94 | struct ip_event ip; |
@@ -90,6 +96,7 @@ typedef union event_union { | |||
90 | struct comm_event comm; | 96 | struct comm_event comm; |
91 | struct fork_event fork; | 97 | struct fork_event fork; |
92 | struct period_event period; | 98 | struct period_event period; |
99 | struct lost_event lost; | ||
93 | } event_t; | 100 | } event_t; |
94 | 101 | ||
95 | static LIST_HEAD(dsos); | 102 | static LIST_HEAD(dsos); |
@@ -1068,7 +1075,8 @@ static unsigned long total = 0, | |||
1068 | total_mmap = 0, | 1075 | total_mmap = 0, |
1069 | total_comm = 0, | 1076 | total_comm = 0, |
1070 | total_fork = 0, | 1077 | total_fork = 0, |
1071 | total_unknown = 0; | 1078 | total_unknown = 0, |
1079 | total_lost = 0; | ||
1072 | 1080 | ||
1073 | static int validate_chain(struct perf_callchain_entry *chain, event_t *event) | 1081 | static int validate_chain(struct perf_callchain_entry *chain, event_t *event) |
1074 | { | 1082 | { |
@@ -1260,6 +1268,20 @@ process_period_event(event_t *event, unsigned long offset, unsigned long head) | |||
1260 | return 0; | 1268 | return 0; |
1261 | } | 1269 | } |
1262 | 1270 | ||
1271 | static int | ||
1272 | process_lost_event(event_t *event, unsigned long offset, unsigned long head) | ||
1273 | { | ||
1274 | dprintf("%p [%p]: PERF_EVENT_LOST: id:%Ld: lost:%Ld\n", | ||
1275 | (void *)(offset + head), | ||
1276 | (void *)(long)(event->header.size), | ||
1277 | event->lost.id, | ||
1278 | event->lost.lost); | ||
1279 | |||
1280 | total_lost += event->lost.lost; | ||
1281 | |||
1282 | return 0; | ||
1283 | } | ||
1284 | |||
1263 | static void trace_event(event_t *event) | 1285 | static void trace_event(event_t *event) |
1264 | { | 1286 | { |
1265 | unsigned char *raw_event = (void *)event; | 1287 | unsigned char *raw_event = (void *)event; |
@@ -1316,6 +1338,10 @@ process_event(event_t *event, unsigned long offset, unsigned long head) | |||
1316 | 1338 | ||
1317 | case PERF_EVENT_PERIOD: | 1339 | case PERF_EVENT_PERIOD: |
1318 | return process_period_event(event, offset, head); | 1340 | return process_period_event(event, offset, head); |
1341 | |||
1342 | case PERF_EVENT_LOST: | ||
1343 | return process_lost_event(event, offset, head); | ||
1344 | |||
1319 | /* | 1345 | /* |
1320 | * We dont process them right now but they are fine: | 1346 | * We dont process them right now but they are fine: |
1321 | */ | 1347 | */ |
@@ -1444,6 +1470,7 @@ more: | |||
1444 | dprintf(" mmap events: %10ld\n", total_mmap); | 1470 | dprintf(" mmap events: %10ld\n", total_mmap); |
1445 | dprintf(" comm events: %10ld\n", total_comm); | 1471 | dprintf(" comm events: %10ld\n", total_comm); |
1446 | dprintf(" fork events: %10ld\n", total_fork); | 1472 | dprintf(" fork events: %10ld\n", total_fork); |
1473 | dprintf(" lost events: %10ld\n", total_lost); | ||
1447 | dprintf(" unknown events: %10ld\n", total_unknown); | 1474 | dprintf(" unknown events: %10ld\n", total_unknown); |
1448 | 1475 | ||
1449 | if (dump_trace) | 1476 | if (dump_trace) |