Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 169491
b: refs/heads/master
c: f4f0b41
h: refs/heads/master
i:
  169489: fd40556
  169487: cf644a8
v: v3
  • Loading branch information
Mike Galbraith authored and Ingo Molnar committed Oct 13, 2009
1 parent 0987296 commit 888d12f
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 15 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: cfed95a693e1ea5d08b9c9019bc30e448437ee2f
refs/heads/master: f4f0b418188cc7995375acbb54e87c80f21861bd
15 changes: 1 addition & 14 deletions trunk/tools/perf/builtin-top.c
Original file line number Diff line number Diff line change
Expand Up @@ -870,17 +870,13 @@ static unsigned int mmap_read_head(struct mmap_data *md)
return head;
}

struct timeval last_read, this_read;

static void mmap_read_counter(struct mmap_data *md)
{
unsigned int head = mmap_read_head(md);
unsigned int old = md->prev;
unsigned char *data = md->base + page_size;
int diff;

gettimeofday(&this_read, NULL);

/*
* 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.
Expand All @@ -891,23 +887,14 @@ static void mmap_read_counter(struct mmap_data *md)
*/
diff = head - old;
if (diff > md->mask / 2 || diff < 0) {
struct timeval iv;
unsigned long msecs;

timersub(&this_read, &last_read, &iv);
msecs = iv.tv_sec*1000 + iv.tv_usec/1000;

fprintf(stderr, "WARNING: failed to keep up with mmap data."
" Last read %lu msecs ago.\n", msecs);
fprintf(stderr, "WARNING: failed to keep up with mmap data.\n");

/*
* head points to a known good entry, start there.
*/
old = head;
}

last_read = this_read;

for (; old != head;) {
event_t *event = (event_t *)&data[old & md->mask];

Expand Down

0 comments on commit 888d12f

Please sign in to comment.