diff options
Diffstat (limited to 'tools/perf/tests/thread-map.c')
-rw-r--r-- | tools/perf/tests/thread-map.c | 43 |
1 files changed, 25 insertions, 18 deletions
diff --git a/tools/perf/tests/thread-map.c b/tools/perf/tests/thread-map.c index ccc17aced49e..39168c57943b 100644 --- a/tools/perf/tests/thread-map.c +++ b/tools/perf/tests/thread-map.c @@ -1,19 +1,26 @@ // SPDX-License-Identifier: GPL-2.0 #include <stdlib.h> +#include <string.h> #include <sys/types.h> #include <unistd.h> #include <sys/prctl.h> #include "tests.h" #include "thread_map.h" #include "debug.h" +#include "event.h" #include <linux/zalloc.h> +#include <perf/event.h> + +struct perf_sample; +struct perf_tool; +struct machine; #define NAME (const char *) "perf" #define NAMEUL (unsigned long) NAME int test__thread_map(struct test *test __maybe_unused, int subtest __maybe_unused) { - struct thread_map *map; + struct perf_thread_map *map; TEST_ASSERT_VAL("failed to set process name", !prctl(PR_SET_NAME, NAMEUL, 0, 0, 0)); @@ -26,28 +33,28 @@ int test__thread_map(struct test *test __maybe_unused, int subtest __maybe_unuse TEST_ASSERT_VAL("wrong nr", map->nr == 1); TEST_ASSERT_VAL("wrong pid", - thread_map__pid(map, 0) == getpid()); + perf_thread_map__pid(map, 0) == getpid()); TEST_ASSERT_VAL("wrong comm", - thread_map__comm(map, 0) && - !strcmp(thread_map__comm(map, 0), NAME)); + perf_thread_map__comm(map, 0) && + !strcmp(perf_thread_map__comm(map, 0), NAME)); TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1); - thread_map__put(map); + perf_thread_map__put(map); /* test dummy pid */ - map = thread_map__new_dummy(); + map = perf_thread_map__new_dummy(); TEST_ASSERT_VAL("failed to alloc map", map); thread_map__read_comms(map); TEST_ASSERT_VAL("wrong nr", map->nr == 1); - TEST_ASSERT_VAL("wrong pid", thread_map__pid(map, 0) == -1); + TEST_ASSERT_VAL("wrong pid", perf_thread_map__pid(map, 0) == -1); TEST_ASSERT_VAL("wrong comm", - thread_map__comm(map, 0) && - !strcmp(thread_map__comm(map, 0), "dummy")); + perf_thread_map__comm(map, 0) && + !strcmp(perf_thread_map__comm(map, 0), "dummy")); TEST_ASSERT_VAL("wrong refcnt", refcount_read(&map->refcnt) == 1); - thread_map__put(map); + perf_thread_map__put(map); return 0; } @@ -56,8 +63,8 @@ static int process_event(struct perf_tool *tool __maybe_unused, struct perf_sample *sample __maybe_unused, struct machine *machine __maybe_unused) { - struct thread_map_event *map = &event->thread_map; - struct thread_map *threads; + struct perf_record_thread_map *map = &event->thread_map; + struct perf_thread_map *threads; TEST_ASSERT_VAL("wrong nr", map->nr == 1); TEST_ASSERT_VAL("wrong pid", map->entries[0].pid == (u64) getpid()); @@ -68,19 +75,19 @@ static int process_event(struct perf_tool *tool __maybe_unused, TEST_ASSERT_VAL("wrong nr", threads->nr == 1); TEST_ASSERT_VAL("wrong pid", - thread_map__pid(threads, 0) == getpid()); + perf_thread_map__pid(threads, 0) == getpid()); TEST_ASSERT_VAL("wrong comm", - thread_map__comm(threads, 0) && - !strcmp(thread_map__comm(threads, 0), NAME)); + perf_thread_map__comm(threads, 0) && + !strcmp(perf_thread_map__comm(threads, 0), NAME)); TEST_ASSERT_VAL("wrong refcnt", refcount_read(&threads->refcnt) == 1); - thread_map__put(threads); + perf_thread_map__put(threads); return 0; } int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __maybe_unused) { - struct thread_map *threads; + struct perf_thread_map *threads; TEST_ASSERT_VAL("failed to set process name", !prctl(PR_SET_NAME, NAMEUL, 0, 0, 0)); @@ -99,7 +106,7 @@ int test__thread_map_synthesize(struct test *test __maybe_unused, int subtest __ int test__thread_map_remove(struct test *test __maybe_unused, int subtest __maybe_unused) { - struct thread_map *threads; + struct perf_thread_map *threads; char *str; int i; |