提交 ef365cef 编写于 作者: R Russ Anderson 提交者: Arnaldo Carvalho de Melo

perf record: remove unneeded gettimeofday() call

Perf record repeatedly calls gettimeofday() which adds noise to the performance
measurements.  Since gettimeofday() is only used for the error printf, delete
it.

Cc: Ingo Molnar <mingo@elte.hu>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
LKML-Reference: <20100518225240.GC25589@sgi.com>
Signed-off-by: NRuss Anderson <rja@sgi.com>
Signed-off-by: NArnaldo Carvalho de Melo <acme@redhat.com>
上级 dfacc4d6
...@@ -65,9 +65,6 @@ static bool multiplex = false; ...@@ -65,9 +65,6 @@ static bool multiplex = false;
static int multiplex_fd = -1; static int multiplex_fd = -1;
static long samples = 0; static long samples = 0;
static struct timeval last_read;
static struct timeval this_read;
static u64 bytes_written = 0; static u64 bytes_written = 0;
static struct pollfd *event_array; static struct pollfd *event_array;
...@@ -147,8 +144,6 @@ static void mmap_read(struct mmap_data *md) ...@@ -147,8 +144,6 @@ static void mmap_read(struct mmap_data *md)
void *buf; void *buf;
int diff; int diff;
gettimeofday(&this_read, NULL);
/* /*
* If we're further behind than half the buffer, there's a chance * 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. * the writer will bite our tail and mess up the samples under us.
...@@ -159,23 +154,13 @@ static void mmap_read(struct mmap_data *md) ...@@ -159,23 +154,13 @@ static void mmap_read(struct mmap_data *md)
*/ */
diff = head - old; diff = head - old;
if (diff < 0) { if (diff < 0) {
struct timeval iv; fprintf(stderr, "WARNING: failed to keep up with mmap data\n");
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);
/* /*
* head points to a known good entry, start there. * head points to a known good entry, start there.
*/ */
old = head; old = head;
} }
last_read = this_read;
if (old != head) if (old != head)
samples++; samples++;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册