From: Adrian Hunter Date: Tue, 22 Jul 2014 13:17:19 +0000 (+0300) Subject: perf tools: Add dso__data_status_seen() X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=288be943b5024729cd6809b61b62f727960178f3;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git perf tools: Add dso__data_status_seen() 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 Cc: David Ahern Cc: Frederic Weisbecker Cc: Jiri Olsa Cc: Namhyung Kim Cc: Paul Mackerras Cc: Peter Zijlstra Cc: Stephane Eranian Link: http://lkml.kernel.org/r/1406035081-14301-11-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo --- diff --git a/tools/perf/util/dso.c b/tools/perf/util/dso.c index 8827db3d2cba..84e4a0546a31 100644 --- a/tools/perf/util/dso.c +++ b/tools/perf/util/dso.c @@ -359,6 +359,18 @@ out: 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) { diff --git a/tools/perf/util/dso.h b/tools/perf/util/dso.h index aeb7bcbf0239..c805f604da1f 100644 --- a/tools/perf/util/dso.h +++ b/tools/perf/util/dso.h @@ -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; \ @@ -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; @@ -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,