Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 199114
b: refs/heads/master
c: acd35a4
h: refs/heads/master
v: v3
  • Loading branch information
Frederic Weisbecker committed May 20, 2010
1 parent 8380fe3 commit 1478290
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 58 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: b36f19d572151abb987ce308a3e066b977a2146f
refs/heads/master: acd35a463cb2a8d2b28e094d718cf6e653ad7191
3 changes: 2 additions & 1 deletion trunk/kernel/perf_event.c
Original file line number Diff line number Diff line change
Expand Up @@ -2933,7 +2933,7 @@ static void perf_output_put_handle(struct perf_output_handle *handle)
*/

if (!local_dec_and_test(&data->nest))
return;
goto out;

/*
* Publish the known good head. Rely on the full barrier implied
Expand All @@ -2954,6 +2954,7 @@ 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();
}

Expand Down
22 changes: 0 additions & 22 deletions trunk/tools/perf/util/build-id.c
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,6 @@
* Copyright (C) 2009, 2010 Red Hat Inc.
* Copyright (C) 2009, 2010 Arnaldo Carvalho de Melo <acme@redhat.com>
*/
#include "util.h"
#include <stdio.h>
#include "build-id.h"
#include "event.h"
#include "symbol.h"
Expand Down Expand Up @@ -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;
}
2 changes: 0 additions & 2 deletions trunk/tools/perf/util/build-id.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
1 change: 0 additions & 1 deletion trunk/tools/perf/util/callchain.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
#include <errno.h>
#include <math.h>

#include "util.h"
#include "callchain.h"

bool ip_callchain__valid(struct ip_callchain *chain, event_t *event)
Expand Down
1 change: 1 addition & 0 deletions trunk/tools/perf/util/callchain.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
#include <linux/list.h>
#include <linux/rbtree.h>
#include "event.h"
#include "util.h"
#include "symbol.h"

enum chain_mode {
Expand Down
34 changes: 8 additions & 26 deletions trunk/tools/perf/util/hist.c
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
#include "build-id.h"
#include "util.h"
#include "hist.h"
#include "session.h"
Expand Down Expand Up @@ -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__,
Expand All @@ -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)
Expand Down
2 changes: 0 additions & 2 deletions trunk/tools/perf/util/newt.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down Expand Up @@ -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;

Expand Down
12 changes: 9 additions & 3 deletions trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
#include <sys/param.h>
#include <fcntl.h>
#include <unistd.h>
#include "build-id.h"
#include "symbol.h"
#include "strlist.h"

Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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++;
Expand All @@ -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,
Expand Down

0 comments on commit 1478290

Please sign in to comment.