Re: [tip:perfcounters/core] perf_counter tools: Handle lost events

From: Corey Ashford
Date: Thu Jun 18 2009 - 17:17:23 EST

tip-bot for Peter Zijlstra wrote:
Commit-ID: 9d91a6f7a489eb914c16b82d927f9d81d629c259
Author: Peter Zijlstra <a.p.zijlstra@xxxxxxxxx>
AuthorDate: Thu, 18 Jun 2009 11:40:28 +0200
Committer: Ingo Molnar <mingo@xxxxxxx>
CommitDate: Thu, 18 Jun 2009 14:46:11 +0200

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.
@@ -109,7 +120,7 @@ static void mmap_read(struct mmap_data *md)
* In either case, truncate and restart at head.
diff = head - old;
- if (diff > md->mask / 2 || diff < 0) {
+ if (diff < 0) {
struct timeval iv;
unsigned long msecs;


Hi Peter,

Very nice change. One thing missing though on the above is an update to the comment which precedes snippet, which currently reads:

* If we're further behind than half the buffer, there's a chance
* the writer will bite our tail and mess up the samples under us.
* If we somehow ended up ahead of the head, we got messed up.
* In either case, truncate and restart at head.

The "further behind than half the buffer" no longer pertains. Maybe:

* If we've gotten behind, truncate and restart at head.


- Corey

Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain

To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at
Please read the FAQ at