Skip to content

Commit

Permalink
perf tools: Add dso__data_status_seen()
Browse files Browse the repository at this point in the history
Add a function to track whether a caller has seen the data status of a
dso.  This is needed to enable callers to report the error exactly once
only per dso.

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-11-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 c27697d commit 288be94
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
12 changes: 12 additions & 0 deletions tools/perf/util/dso.c
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,18 @@ int dso__data_fd(struct dso *dso, struct machine *machine)
return dso->data.fd;
}

bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by)
{
u32 flag = 1 << by;

if (dso->data.status_seen & flag)
return true;

dso->data.status_seen |= flag;

return false;
}

static void
dso_cache__free(struct rb_root *root)
{
Expand Down
6 changes: 6 additions & 0 deletions tools/perf/util/dso.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,10 @@ enum dso_data_status {
DSO_DATA_STATUS_OK = 1,
};

enum dso_data_status_seen {
DSO_DATA_STATUS_SEEN_ITRACE,
};

#define DSO__SWAP(dso, type, val) \
({ \
type ____r = val; \
Expand Down Expand Up @@ -111,6 +115,7 @@ struct dso {
struct rb_root cache;
int fd;
int status;
u32 status_seen;
size_t file_size;
struct list_head open_entry;
} data;
Expand Down Expand Up @@ -203,6 +208,7 @@ ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
ssize_t dso__data_read_addr(struct dso *dso, struct map *map,
struct machine *machine, u64 addr,
u8 *data, ssize_t size);
bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by);

struct map *dso__new_map(const char *name);
struct dso *dso__kernel_findnew(struct machine *machine, const char *name,
Expand Down

0 comments on commit 288be94

Please sign in to comment.