Skip to content

Commit

Permalink
perf tools: Add dsos__hit_all()
Browse files Browse the repository at this point in the history
Add ability to mark all dsos as hit.

This is needed in the case of Instruction Tracing.  It takes so long to
decode an Instruction Trace that it is not worth doing just to determine
which dsos are hit.  A later patch takes this into use.

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@gmail.com>
Cc: Paul Mackerras <paulus@samba.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Stephane Eranian <eranian@google.com>
Link: http://lkml.kernel.org/r/1406035081-14301-15-git-send-email-adrian.hunter@intel.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Adrian Hunter authored and Arnaldo Carvalho de Melo committed Jul 23, 2014
1 parent 288be94 commit 1f625b0
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 0 deletions.
41 changes: 41 additions & 0 deletions tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -200,6 +200,47 @@ static int write_buildid(const char *name, size_t name_len, u8 *build_id,
return write_padded(fd, name, name_len + 1, len);
}

static int __dsos__hit_all(struct list_head *head)
{
struct dso *pos;

list_for_each_entry(pos, head, node)
pos->hit = true;

return 0;
}

static int machine__hit_all_dsos(struct machine *machine)
{
int err;

err = __dsos__hit_all(&machine->kernel_dsos);
if (err)
return err;

return __dsos__hit_all(&machine->user_dsos);
}

int dsos__hit_all(struct perf_session *session)
{
struct rb_node *nd;
int err;

err = machine__hit_all_dsos(&session->machines.host);
if (err)
return err;

for (nd = rb_first(&session->machines.guests); nd; nd = rb_next(nd)) {
struct machine *pos = rb_entry(nd, struct machine, rb_node);

err = machine__hit_all_dsos(pos);
if (err)
return err;
}

return 0;
}

static int __dsos__write_buildid_table(struct list_head *head,
struct machine *machine,
pid_t pid, u16 misc, int fd)
Expand Down
2 changes: 2 additions & 0 deletions tools/perf/util/header.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,8 @@ int perf_event__process_build_id(struct perf_tool *tool,
struct perf_session *session);
bool is_perf_magic(u64 magic);

int dsos__hit_all(struct perf_session *session);

/*
* arch specific callback
*/
Expand Down

0 comments on commit 1f625b0

Please sign in to comment.