diff options
author | Russ Anderson <rja@sgi.com> | 2010-05-18 18:52:40 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2010-05-20 20:53:58 -0400 |
commit | ef365cefbc53d8674a18520a1d4c2e5590127299 (patch) | |
tree | 75566178dedd11a685d4240523849ad6787fb549 /tools | |
parent | dfacc4d6c98b89609250269f518c1f54c30454ef (diff) |
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: Russ Anderson <rja@sgi.com>
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/builtin-record.c | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/tools/perf/builtin-record.c b/tools/perf/builtin-record.c index 66b8ecd22cfe..e67226981834 100644 --- a/tools/perf/builtin-record.c +++ b/tools/perf/builtin-record.c | |||
@@ -65,9 +65,6 @@ static bool multiplex = false; | |||
65 | static int multiplex_fd = -1; | 65 | static int multiplex_fd = -1; |
66 | 66 | ||
67 | static long samples = 0; | 67 | static long samples = 0; |
68 | static struct timeval last_read; | ||
69 | static struct timeval this_read; | ||
70 | |||
71 | static u64 bytes_written = 0; | 68 | static u64 bytes_written = 0; |
72 | 69 | ||
73 | static struct pollfd *event_array; | 70 | static struct pollfd *event_array; |
@@ -147,8 +144,6 @@ static void mmap_read(struct mmap_data *md) | |||
147 | void *buf; | 144 | void *buf; |
148 | int diff; | 145 | int diff; |
149 | 146 | ||
150 | gettimeofday(&this_read, NULL); | ||
151 | |||
152 | /* | 147 | /* |
153 | * If we're further behind than half the buffer, there's a chance | 148 | * If we're further behind than half the buffer, there's a chance |
154 | * the writer will bite our tail and mess up the samples under us. | 149 | * 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 | */ | 154 | */ |
160 | diff = head - old; | 155 | diff = head - old; |
161 | if (diff < 0) { | 156 | if (diff < 0) { |
162 | struct timeval iv; | 157 | fprintf(stderr, "WARNING: failed to keep up with mmap data\n"); |
163 | unsigned long msecs; | ||
164 | |||
165 | timersub(&this_read, &last_read, &iv); | ||
166 | msecs = iv.tv_sec*1000 + iv.tv_usec/1000; | ||
167 | |||
168 | fprintf(stderr, "WARNING: failed to keep up with mmap data." | ||
169 | " Last read %lu msecs ago.\n", msecs); | ||
170 | |||
171 | /* | 158 | /* |
172 | * head points to a known good entry, start there. | 159 | * head points to a known good entry, start there. |
173 | */ | 160 | */ |
174 | old = head; | 161 | old = head; |
175 | } | 162 | } |
176 | 163 | ||
177 | last_read = this_read; | ||
178 | |||
179 | if (old != head) | 164 | if (old != head) |
180 | samples++; | 165 | samples++; |
181 | 166 | ||