summaryrefslogtreecommitdiffstats
path: root/tools/perf/util/auxtrace.h
diff options
context:
space:
mode:
authorAdrian Hunter <adrian.hunter@intel.com>2015-04-09 18:53:54 +0300
committerArnaldo Carvalho de Melo <acme@redhat.com>2015-04-29 10:37:55 -0300
commitc3278f0231e833c6030c3aeab510415fdbbfd353 (patch)
tree7ec3f9c9bad02da9ec8a58590a3446ba720edec3 /tools/perf/util/auxtrace.h
parent73f75fb1bdc572f97f1eb375f2bbb68cfcba077c (diff)
downloadtalos-obmc-linux-c3278f0231e833c6030c3aeab510415fdbbfd353.tar.gz
talos-obmc-linux-c3278f0231e833c6030c3aeab510415fdbbfd353.zip
perf auxtrace: Add a hashtable for caching
Decoding AUX area data may involve walking object code. Rather than repetitively decoding the same instructions, a cache can be used to cache the results. This patch implements a fairly generic hashtable with a 32-bit key that could be used for other purposes as well. 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: Peter Zijlstra <peterz@infradead.org> Cc: Stephane Eranian <eranian@google.com> Link: http://lkml.kernel.org/r/1428594864-29309-15-git-send-email-adrian.hunter@intel.com Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/util/auxtrace.h')
-rw-r--r--tools/perf/util/auxtrace.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/tools/perf/util/auxtrace.h b/tools/perf/util/auxtrace.h
index ba78d825bf73..53b60a64a693 100644
--- a/tools/perf/util/auxtrace.h
+++ b/tools/perf/util/auxtrace.h
@@ -333,6 +333,20 @@ int auxtrace_heap__add(struct auxtrace_heap *heap, unsigned int queue_nr,
void auxtrace_heap__pop(struct auxtrace_heap *heap);
void auxtrace_heap__free(struct auxtrace_heap *heap);
+struct auxtrace_cache_entry {
+ struct hlist_node hash;
+ u32 key;
+};
+
+struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size,
+ unsigned int limit_percent);
+void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache);
+void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c);
+void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry);
+int auxtrace_cache__add(struct auxtrace_cache *c, u32 key,
+ struct auxtrace_cache_entry *entry);
+void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key);
+
struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist,
int *err);
OpenPOWER on IntegriCloud