aboutsummaryrefslogtreecommitdiffstats
path: root/tools/perf
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2014-07-22 09:17:19 -0400
committerArnaldo Carvalho de Melo <acme@redhat.com>2014-07-23 10:23:44 -0400
commit288be943b5024729cd6809b61b62f727960178f3 (patch)
treeac7ec9cebe169d8305059b0d2135680afd4f9f92 /tools/perf
parentc27697d6dee02ef2389b6701c792a075bc9873dc (diff)
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 <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>
Diffstat (limited to 'tools/perf')
-rw-r--r--tools/perf/util/dso.c12
-rw-r--r--tools/perf/util/dso.h6
2 files changed, 18 insertions, 0 deletions
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:
359 return dso->data.fd; 359 return dso->data.fd;
360} 360}
361 361
362bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by)
363{
364 u32 flag = 1 << by;
365
366 if (dso->data.status_seen & flag)
367 return true;
368
369 dso->data.status_seen |= flag;
370
371 return false;
372}
373
362static void 374static void
363dso_cache__free(struct rb_root *root) 375dso_cache__free(struct rb_root *root)
364{ 376{
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 {
46 DSO_DATA_STATUS_OK = 1, 46 DSO_DATA_STATUS_OK = 1,
47}; 47};
48 48
49enum dso_data_status_seen {
50 DSO_DATA_STATUS_SEEN_ITRACE,
51};
52
49#define DSO__SWAP(dso, type, val) \ 53#define DSO__SWAP(dso, type, val) \
50({ \ 54({ \
51 type ____r = val; \ 55 type ____r = val; \
@@ -111,6 +115,7 @@ struct dso {
111 struct rb_root cache; 115 struct rb_root cache;
112 int fd; 116 int fd;
113 int status; 117 int status;
118 u32 status_seen;
114 size_t file_size; 119 size_t file_size;
115 struct list_head open_entry; 120 struct list_head open_entry;
116 } data; 121 } data;
@@ -203,6 +208,7 @@ ssize_t dso__data_read_offset(struct dso *dso, struct machine *machine,
203ssize_t dso__data_read_addr(struct dso *dso, struct map *map, 208ssize_t dso__data_read_addr(struct dso *dso, struct map *map,
204 struct machine *machine, u64 addr, 209 struct machine *machine, u64 addr,
205 u8 *data, ssize_t size); 210 u8 *data, ssize_t size);
211bool dso__data_status_seen(struct dso *dso, enum dso_data_status_seen by);
206 212
207struct map *dso__new_map(const char *name); 213struct map *dso__new_map(const char *name);
208struct dso *dso__kernel_findnew(struct machine *machine, const char *name, 214struct dso *dso__kernel_findnew(struct machine *machine, const char *name,