Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 191315
b: refs/heads/master
c: 1f626bc
h: refs/heads/master
i:
  191313: 96b2c13
  191311: 874c503
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo committed May 10, 2010
1 parent 992f2ff commit d1a1f45
Show file tree
Hide file tree
Showing 7 changed files with 30 additions and 32 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: 4cc4945844fe2cf493f1783b6ce938ba1617d5c2
refs/heads/master: 1f626bc36847ac8dd192f055aed0f9678a781313
10 changes: 10 additions & 0 deletions trunk/tools/perf/util/event.c
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,16 @@ int event__preprocess_sample(const event_t *self, struct perf_session *session,
goto out_filtered;

dump_printf(" ... thread: %s:%d\n", thread->comm, thread->pid);
/*
* Have we already created the kernel maps for the host machine?
*
* This should have happened earlier, when we processed the kernel MMAP
* events, but for older perf.data files there was no such thing, so do
* it now.
*/
if (cpumode == PERF_RECORD_MISC_KERNEL &&
session->host_machine.vmlinux_maps[MAP__FUNCTION] == NULL)
machine__create_kernel_maps(&session->host_machine);

thread__find_addr_map(thread, session, cpumode, MAP__FUNCTION,
self->ip.pid, self->ip.ip, al);
Expand Down
24 changes: 0 additions & 24 deletions trunk/tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -579,30 +579,6 @@ struct machine *machines__find(struct rb_root *self, pid_t pid)
return default_machine;
}

/*
* FIXME: Why repeatedly search for this?
*/
struct machine *machines__find_host(struct rb_root *self)
{
struct rb_node **p = &self->rb_node;
struct rb_node *parent = NULL;
struct machine *machine;
pid_t pid = HOST_KERNEL_ID;

while (*p != NULL) {
parent = *p;
machine = rb_entry(parent, struct machine, rb_node);
if (pid < machine->pid)
p = &(*p)->rb_left;
else if (pid > machine->pid)
p = &(*p)->rb_right;
else
return machine;
}

return NULL;
}

struct machine *machines__findnew(struct rb_root *self, pid_t pid)
{
char path[PATH_MAX];
Expand Down
8 changes: 8 additions & 0 deletions trunk/tools/perf/util/session.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ struct perf_session *perf_session__new(const char *filename, int mode, bool forc
self->repipe = repipe;
self->ordered_samples.flush_limit = ULLONG_MAX;
INIT_LIST_HEAD(&self->ordered_samples.samples_head);
machine__init(&self->host_machine, "", HOST_KERNEL_ID);

if (mode == O_RDONLY) {
if (perf_session__open(self, force) < 0)
Expand Down Expand Up @@ -870,3 +871,10 @@ int perf_session__set_kallsyms_ref_reloc_sym(struct map **maps,

return 0;
}

size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp)
{
return __dsos__fprintf(&self->host_machine.kernel_dsos, fp) +
__dsos__fprintf(&self->host_machine.user_dsos, fp) +
machines__fprintf_dsos(&self->machines, fp);
}
14 changes: 8 additions & 6 deletions trunk/tools/perf/util/session.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ struct perf_session {
unsigned long mmap_window;
struct rb_root threads;
struct thread *last_match;
struct machine host_machine;
struct rb_root machines;
struct events_stats events_stats;
struct rb_root stats_by_id;
Expand Down Expand Up @@ -107,33 +108,34 @@ int perf_session__browse_hists(struct rb_root *hists, u64 nr_hists,
static inline
struct machine *perf_session__find_host_machine(struct perf_session *self)
{
return machines__find_host(&self->machines);
return &self->host_machine;
}

static inline
struct machine *perf_session__find_machine(struct perf_session *self, pid_t pid)
{
if (pid == HOST_KERNEL_ID)
return &self->host_machine;
return machines__find(&self->machines, pid);
}

static inline
struct machine *perf_session__findnew_machine(struct perf_session *self, pid_t pid)
{
if (pid == HOST_KERNEL_ID)
return &self->host_machine;
return machines__findnew(&self->machines, pid);
}

static inline
void perf_session__process_machines(struct perf_session *self,
machine__process_t process)
{
process(&self->host_machine, self);
return machines__process(&self->machines, process, self);
}

static inline
size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp)
{
return machines__fprintf_dsos(&self->machines, fp);
}
size_t perf_session__fprintf_dsos(struct perf_session *self, FILE *fp);

static inline
size_t perf_session__fprintf_dsos_buildid(struct perf_session *self, FILE *fp,
Expand Down
2 changes: 1 addition & 1 deletion trunk/tools/perf/util/symbol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1889,7 +1889,7 @@ struct dso *__dsos__findnew(struct list_head *head, const char *name)
return dso;
}

static size_t __dsos__fprintf(struct list_head *head, FILE *fp)
size_t __dsos__fprintf(struct list_head *head, FILE *fp)
{
struct dso *pos;
size_t ret = 0;
Expand Down
2 changes: 2 additions & 0 deletions trunk/tools/perf/util/symbol.h
Original file line number Diff line number Diff line change
Expand Up @@ -167,6 +167,8 @@ int machine__load_kallsyms(struct machine *self, const char *filename,
int machine__load_vmlinux_path(struct machine *self, enum map_type type,
symbol_filter_t filter);

size_t __dsos__fprintf(struct list_head *head, FILE *fp);

size_t machines__fprintf_dsos(struct rb_root *self, FILE *fp);
size_t machines__fprintf_dsos_buildid(struct rb_root *self, FILE *fp, bool with_hits);

Expand Down

0 comments on commit d1a1f45

Please sign in to comment.