diff options
author | Ian Rogers <irogers@google.com> | 2024-02-29 21:36:44 -0800 |
---|---|---|
committer | Namhyung Kim <namhyung@kernel.org> | 2024-03-03 22:52:04 -0800 |
commit | 412a2ff473ac01b195eb38c0853ce065b524b2e2 (patch) | |
tree | 6898594528c68f269b9f98715924371df334e0a1 /tools/perf/util/threads.h | |
parent | 93bb5b0d9394cbf49b76823c48ed8b815a5d899c (diff) |
perf threads: Switch from rbtree to hashmap
The rbtree provides a sorting on entries but this is unused. Switch to
using hashmap for O(1) rather than O(log n) find/insert/remove
complexity.
Signed-off-by: Ian Rogers <irogers@google.com>
Acked-by: Namhyung Kim <namhyung@kernel.org>
Cc: Yang Jihong <yangjihong1@huawei.com>
Cc: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Namhyung Kim <namhyung@kernel.org>
Link: https://lore.kernel.org/r/20240301053646.1449657-7-irogers@google.com
Diffstat (limited to 'tools/perf/util/threads.h')
-rw-r--r-- | tools/perf/util/threads.h | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/tools/perf/util/threads.h b/tools/perf/util/threads.h index ed67de6275782..d03bd91a77692 100644 --- a/tools/perf/util/threads.h +++ b/tools/perf/util/threads.h @@ -2,7 +2,7 @@ #ifndef __PERF_THREADS_H #define __PERF_THREADS_H -#include <linux/rbtree.h> +#include "hashmap.h" #include "rwsem.h" struct thread; @@ -11,9 +11,9 @@ struct thread; #define THREADS__TABLE_SIZE (1 << THREADS__TABLE_BITS) struct threads_table_entry { - struct rb_root_cached entries; + /* Key is tid, value is struct thread. */ + struct hashmap shard; struct rw_semaphore lock; - unsigned int nr; struct thread *last_match; }; |