From f8a590ab6d77ccf84f8d333b7f84770cce4b303c Mon Sep 17 00:00:00 2001 From: Russ Anderson Date: Tue, 18 May 2010 17:52:40 -0500 Subject: [PATCH] --- yaml --- r: 199116 b: refs/heads/master c: ef365cefbc53d8674a18520a1d4c2e5590127299 h: refs/heads/master v: v3 --- [refs] | 2 +- trunk/kernel/perf_event.c | 3 +-- trunk/tools/perf/builtin-record.c | 17 +--------------- trunk/tools/perf/util/build-id.c | 22 -------------------- trunk/tools/perf/util/build-id.h | 2 -- trunk/tools/perf/util/callchain.c | 1 - trunk/tools/perf/util/callchain.h | 1 + trunk/tools/perf/util/hist.c | 34 ++++++++----------------------- trunk/tools/perf/util/newt.c | 2 -- trunk/tools/perf/util/symbol.c | 12 ++++++++--- 10 files changed, 21 insertions(+), 75 deletions(-) diff --git a/[refs] b/[refs] index 87a6d589a0ab..3c19c697464c 100644 --- a/[refs] +++ b/[refs] @@ -1,2 +1,2 @@ --- -refs/heads/master: 915e555822629421d97f851c6b87bf4c314ed8c9 +refs/heads/master: ef365cefbc53d8674a18520a1d4c2e5590127299 diff --git a/trunk/kernel/perf_event.c b/trunk/kernel/perf_event.c index 45b7aec55458..2a060be3b07f 100644 --- a/trunk/kernel/perf_event.c +++ b/trunk/kernel/perf_event.c @@ -2933,7 +2933,7 @@ static void perf_output_put_handle(struct perf_output_handle *handle) */ if (!local_dec_and_test(&data->nest)) - goto out; + return; /* * Publish the known good head. Rely on the full barrier implied @@ -2954,7 +2954,6 @@ static void perf_output_put_handle(struct perf_output_handle *handle) if (handle->wakeup != local_read(&data->wakeup)) perf_output_wakeup(handle); - out: preempt_enable(); } diff --git a/trunk/tools/perf/builtin-record.c b/trunk/tools/perf/builtin-record.c index 66b8ecd22cfe..e67226981834 100644 --- a/trunk/tools/perf/builtin-record.c +++ b/trunk/tools/perf/builtin-record.c @@ -65,9 +65,6 @@ static bool multiplex = false; static int multiplex_fd = -1; static long samples = 0; -static struct timeval last_read; -static struct timeval this_read; - static u64 bytes_written = 0; static struct pollfd *event_array; @@ -147,8 +144,6 @@ static void mmap_read(struct mmap_data *md) void *buf; 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. @@ -159,23 +154,13 @@ static void mmap_read(struct mmap_data *md) */ diff = head - old; if (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; - if (old != head) samples++; diff --git a/trunk/tools/perf/util/build-id.c b/trunk/tools/perf/util/build-id.c index 70c5cf87d020..0f60a3906808 100644 --- a/trunk/tools/perf/util/build-id.c +++ b/trunk/tools/perf/util/build-id.c @@ -6,8 +6,6 @@ * Copyright (C) 2009, 2010 Red Hat Inc. * Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo */ -#include "util.h" -#include #include "build-id.h" #include "event.h" #include "symbol.h" @@ -39,23 +37,3 @@ struct perf_event_ops build_id__mark_dso_hit_ops = { .mmap = event__process_mmap, .fork = event__process_task, }; - -char *dso__build_id_filename(struct dso *self, char *bf, size_t size) -{ - char build_id_hex[BUILD_ID_SIZE * 2 + 1]; - const char *home; - - if (!self->has_build_id) - return NULL; - - build_id__sprintf(self->build_id, sizeof(self->build_id), build_id_hex); - home = getenv("HOME"); - if (bf == NULL) { - if (asprintf(&bf, "%s/%s/.build-id/%.2s/%s", home, - DEBUG_CACHE_DIR, build_id_hex, build_id_hex + 2) < 0) - return NULL; - } else - snprintf(bf, size, "%s/%s/.build-id/%.2s/%s", home, - DEBUG_CACHE_DIR, build_id_hex, build_id_hex + 2); - return bf; -} diff --git a/trunk/tools/perf/util/build-id.h b/trunk/tools/perf/util/build-id.h index 5dafb00eaa06..1d981d63cf9a 100644 --- a/trunk/tools/perf/util/build-id.h +++ b/trunk/tools/perf/util/build-id.h @@ -5,6 +5,4 @@ extern struct perf_event_ops build_id__mark_dso_hit_ops; -char *dso__build_id_filename(struct dso *self, char *bf, size_t size); - #endif diff --git a/trunk/tools/perf/util/callchain.c b/trunk/tools/perf/util/callchain.c index 62b69ad4aa73..21a52e0a4435 100644 --- a/trunk/tools/perf/util/callchain.c +++ b/trunk/tools/perf/util/callchain.c @@ -15,7 +15,6 @@ #include #include -#include "util.h" #include "callchain.h" bool ip_callchain__valid(struct ip_callchain *chain, event_t *event) diff --git a/trunk/tools/perf/util/callchain.h b/trunk/tools/perf/util/callchain.h index 1ca73e4a2723..1cba1f5504e7 100644 --- a/trunk/tools/perf/util/callchain.h +++ b/trunk/tools/perf/util/callchain.h @@ -5,6 +5,7 @@ #include #include #include "event.h" +#include "util.h" #include "symbol.h" enum chain_mode { diff --git a/trunk/tools/perf/util/hist.c b/trunk/tools/perf/util/hist.c index 739c39fd0ade..9a71c94f057a 100644 --- a/trunk/tools/perf/util/hist.c +++ b/trunk/tools/perf/util/hist.c @@ -1,4 +1,3 @@ -#include "build-id.h" #include "util.h" #include "hist.h" #include "session.h" @@ -989,35 +988,22 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head) struct symbol *sym = self->ms.sym; struct map *map = self->ms.map; struct dso *dso = map->dso; - char *filename = dso__build_id_filename(dso, NULL, 0); + const char *filename = dso->long_name; char command[PATH_MAX * 2]; FILE *file; - int err = -1; u64 len; - if (filename == NULL) { - if (dso->has_build_id) { - pr_err("Can't annotate %s: not enough memory\n", - sym->name); - return -1; - } - /* - * If we don't have build-ids, well, lets hope that this - * DSO is the same as when 'perf record' ran. - */ - filename = dso->long_name; - } + if (!filename) + return -1; if (dso->origin == DSO__ORIG_KERNEL) { - if (dso->annotate_warned) { - err = 0; - goto out_free_filename; - } + if (dso->annotate_warned) + return 0; dso->annotate_warned = 1; pr_err("Can't annotate %s: No vmlinux file was found in the " "path:\n", sym->name); vmlinux_path__fprintf(stderr); - goto out_free_filename; + return -1; } pr_debug("%s: filename=%s, sym=%s, start=%#Lx, end=%#Lx\n", __func__, @@ -1039,18 +1025,14 @@ int hist_entry__annotate(struct hist_entry *self, struct list_head *head) file = popen(command, "r"); if (!file) - goto out_free_filename; + return -1; while (!feof(file)) if (hist_entry__parse_objdump_line(self, file, head) < 0) break; pclose(file); - err = 0; -out_free_filename: - if (dso->has_build_id) - free(filename); - return err; + return 0; } void hists__inc_nr_events(struct hists *self, u32 type) diff --git a/trunk/tools/perf/util/newt.c b/trunk/tools/perf/util/newt.c index 051022eb5f43..9338d060ee49 100644 --- a/trunk/tools/perf/util/newt.c +++ b/trunk/tools/perf/util/newt.c @@ -383,7 +383,6 @@ static int ui_browser__run(struct ui_browser *self, const char *title, newtFormAddHotKey(self->form, NEWT_KEY_DOWN); newtFormAddHotKey(self->form, NEWT_KEY_PGUP); newtFormAddHotKey(self->form, NEWT_KEY_PGDN); - newtFormAddHotKey(self->form, ' '); newtFormAddHotKey(self->form, NEWT_KEY_HOME); newtFormAddHotKey(self->form, NEWT_KEY_END); @@ -420,7 +419,6 @@ static int ui_browser__run(struct ui_browser *self, const char *title, } break; case NEWT_KEY_PGDN: - case ' ': if (self->first_visible_entry_idx + self->height > self->nr_entries - 1) break; diff --git a/trunk/tools/perf/util/symbol.c b/trunk/tools/perf/util/symbol.c index aaa51ba147df..96bff0e54863 100644 --- a/trunk/tools/perf/util/symbol.c +++ b/trunk/tools/perf/util/symbol.c @@ -11,7 +11,6 @@ #include #include #include -#include "build-id.h" #include "symbol.h" #include "strlist.h" @@ -1294,6 +1293,7 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) int size = PATH_MAX; char *name; u8 build_id[BUILD_ID_SIZE]; + char build_id_hex[BUILD_ID_SIZE * 2 + 1]; int ret = -1; int fd; struct machine *machine; @@ -1325,8 +1325,15 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) } self->origin = DSO__ORIG_BUILD_ID_CACHE; - if (dso__build_id_filename(self, name, size) != NULL) + + if (self->has_build_id) { + build_id__sprintf(self->build_id, sizeof(self->build_id), + build_id_hex); + snprintf(name, size, "%s/%s/.build-id/%.2s/%s", + getenv("HOME"), DEBUG_CACHE_DIR, + build_id_hex, build_id_hex + 2); goto open_file; + } more: do { self->origin++; @@ -1342,7 +1349,6 @@ int dso__load(struct dso *self, struct map *map, symbol_filter_t filter) case DSO__ORIG_BUILDID: if (filename__read_build_id(self->long_name, build_id, sizeof(build_id))) { - char build_id_hex[BUILD_ID_SIZE * 2 + 1]; build_id__sprintf(build_id, sizeof(build_id), build_id_hex); snprintf(name, size,