diff options
author | Adrian Hunter <adrian.hunter@intel.com> | 2015-04-09 11:53:54 -0400 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2015-04-29 09:37:55 -0400 |
commit | c3278f0231e833c6030c3aeab510415fdbbfd353 (patch) | |
tree | 7ec3f9c9bad02da9ec8a58590a3446ba720edec3 /tools/perf/util/auxtrace.h | |
parent | 73f75fb1bdc572f97f1eb375f2bbb68cfcba077c (diff) |
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.h | 14 |
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, | |||
333 | void auxtrace_heap__pop(struct auxtrace_heap *heap); | 333 | void auxtrace_heap__pop(struct auxtrace_heap *heap); |
334 | void auxtrace_heap__free(struct auxtrace_heap *heap); | 334 | void auxtrace_heap__free(struct auxtrace_heap *heap); |
335 | 335 | ||
336 | struct auxtrace_cache_entry { | ||
337 | struct hlist_node hash; | ||
338 | u32 key; | ||
339 | }; | ||
340 | |||
341 | struct auxtrace_cache *auxtrace_cache__new(unsigned int bits, size_t entry_size, | ||
342 | unsigned int limit_percent); | ||
343 | void auxtrace_cache__free(struct auxtrace_cache *auxtrace_cache); | ||
344 | void *auxtrace_cache__alloc_entry(struct auxtrace_cache *c); | ||
345 | void auxtrace_cache__free_entry(struct auxtrace_cache *c, void *entry); | ||
346 | int auxtrace_cache__add(struct auxtrace_cache *c, u32 key, | ||
347 | struct auxtrace_cache_entry *entry); | ||
348 | void *auxtrace_cache__lookup(struct auxtrace_cache *c, u32 key); | ||
349 | |||
336 | struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist, | 350 | struct auxtrace_record *auxtrace_record__init(struct perf_evlist *evlist, |
337 | int *err); | 351 | int *err); |
338 | 352 | ||