Skip to content

Commit

Permalink
perf machine: Introduce machine__findnew_dso() method
Browse files Browse the repository at this point in the history
Similar to machine__findnew_thread(), also prepping for refcounting and
locking, this time for struct dso instances.

Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Jiri Olsa <jolsa@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Link: http://lkml.kernel.org/n/tip-fv3tshv5o1413coh147lszjc@git.kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
  • Loading branch information
Arnaldo Carvalho de Melo committed May 29, 2015
1 parent 3d39ac5 commit aa7cc2a
Show file tree
Hide file tree
Showing 6 changed files with 12 additions and 6 deletions.
3 changes: 1 addition & 2 deletions tools/perf/tests/hists_common.c
Original file line number Diff line number Diff line change
Expand Up @@ -121,8 +121,7 @@ struct machine *setup_fake_machine(struct machines *machines)
size_t k;
struct dso *dso;

dso = __dsos__findnew(&machine->dsos,
fake_symbols[i].dso_name);
dso = machine__findnew_dso(machine, fake_symbols[i].dso_name);
if (dso == NULL)
goto out;

Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -833,7 +833,7 @@ struct dso *machine__findnew_kernel(struct machine *machine, const char *name,
/*
* The kernel dso could be created by build_id processing.
*/
struct dso *dso = __dsos__findnew(&machine->dsos, name);
struct dso *dso = machine__findnew_dso(machine, name);

/*
* We need to run this in all cases, since during the build_id
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -1264,7 +1264,7 @@ static int __event_process_build_id(struct build_id_event *bev,
goto out;
}

dso = __dsos__findnew(&machine->dsos, filename);
dso = machine__findnew_dso(machine, filename);
if (dso != NULL) {
char sbuild_id[BUILD_ID_SIZE * 2 + 1];

Expand Down
7 changes: 6 additions & 1 deletion tools/perf/util/machine.c
Original file line number Diff line number Diff line change
Expand Up @@ -1157,7 +1157,7 @@ static int machine__process_kernel_mmap_event(struct machine *machine,
}

if (kernel == NULL)
kernel = __dsos__findnew(&machine->dsos, kmmap_prefix);
kernel = machine__findnew_dso(machine, kmmap_prefix);
if (kernel == NULL)
goto out_problem;

Expand Down Expand Up @@ -1915,3 +1915,8 @@ int machine__get_kernel_start(struct machine *machine)
}
return err;
}

struct dso *machine__findnew_dso(struct machine *machine, const char *filename)
{
return __dsos__findnew(&machine->dsos, filename);
}
2 changes: 2 additions & 0 deletions tools/perf/util/machine.h
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,8 @@ static inline bool machine__is_host(struct machine *machine)
struct thread *__machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);
struct thread *machine__findnew_thread(struct machine *machine, pid_t pid, pid_t tid);

struct dso *machine__findnew_dso(struct machine *machine, const char *filename);

size_t machine__fprintf(struct machine *machine, FILE *fp);

static inline
Expand Down
2 changes: 1 addition & 1 deletion tools/perf/util/map.c
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ struct map *map__new(struct machine *machine, u64 start, u64 len,
pgoff = 0;
dso = vdso__dso_findnew(machine, thread);
} else
dso = __dsos__findnew(&machine->dsos, filename);
dso = machine__findnew_dso(machine, filename);

if (dso == NULL)
goto out_delete;
Expand Down

0 comments on commit aa7cc2a

Please sign in to comment.