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

Corey Ashford
2009-06-18T21:17:18Z

tip-bot for Peter Zijlstra wrote:
> Commit-ID: 9d91a6f7a489eb914c16b82d927f9d81d629c259
> Gitweb: http://git.kernel.org/tip/9d91a6f7a489eb914c16b82d927f9d81d629c259
> Author: Peter Zijlstra <a.p.zijlstra@chello.nl>
> AuthorDate: Thu, 18 Jun 2009 11:40:28 +0200
> Committer: Ingo Molnar <mingo@elte.hu>
> 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.
[snip]
> @@ -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;
>
[snip]

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.
*/

Regards,

- Corey

Corey Ashford
Software Engineer
IBM Linux Technology Center, Linux Toolchain
cjashfor@us.ibm.com