diff options
author | Jiri Olsa <jolsa@kernel.org> | 2019-08-22 13:11:41 +0200 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2019-08-22 17:16:57 -0300 |
commit | a2f354e3abb853f9a40048829e1f839e8f7fada5 (patch) | |
tree | efd44d199538c509e2a17004ad09c85a045563d1 /tools/perf/lib/threadmap.c | |
parent | 5e51b0bb245d963f5ce750256c504be95201e38c (diff) |
libperf: Add perf_thread_map__nr/perf_thread_map__pid functions
So it's part of libperf library as basic functions operating on
perf_thread_map objects.
Signed-off-by: Jiri Olsa <jolsa@kernel.org>
Cc: Alexander Shishkin <alexander.shishkin@linux.intel.com>
Cc: Michael Petlan <mpetlan@redhat.com>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/20190822111141.25823-6-jolsa@kernel.org
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools/perf/lib/threadmap.c')
-rw-r--r-- | tools/perf/lib/threadmap.c | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/tools/perf/lib/threadmap.c b/tools/perf/lib/threadmap.c index 4865b73e2586..e92c368b0a6c 100644 --- a/tools/perf/lib/threadmap.c +++ b/tools/perf/lib/threadmap.c @@ -79,3 +79,13 @@ void perf_thread_map__put(struct perf_thread_map *map) if (map && refcount_dec_and_test(&map->refcnt)) perf_thread_map__delete(map); } + +int perf_thread_map__nr(struct perf_thread_map *threads) +{ + return threads ? threads->nr : 1; +} + +pid_t perf_thread_map__pid(struct perf_thread_map *map, int thread) +{ + return map->map[thread].pid; +} |