Skip to content

Commit 5128492

Browse files
captain5050namhyung
authored andcommitted
perf thread_map: Remove uid options
Now the target doesn't have a uid, it is handled through BPF filters, remove the uid options to thread_map creation. Tidy up the functions used in tests to avoid passing unused arguments. Signed-off-by: Ian Rogers <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Namhyung Kim <[email protected]>
1 parent b4c658d commit 5128492

12 files changed

+20
-48
lines changed

tools/perf/tests/event-times.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@ static int attach__current_disabled(struct evlist *evlist)
6262

6363
pr_debug("attaching to current thread as disabled\n");
6464

65-
threads = thread_map__new(-1, getpid(), UINT_MAX);
65+
threads = thread_map__new_by_tid(getpid());
6666
if (threads == NULL) {
6767
pr_debug("thread_map__new\n");
6868
return -1;
@@ -88,7 +88,7 @@ static int attach__current_enabled(struct evlist *evlist)
8888

8989
pr_debug("attaching to current thread as enabled\n");
9090

91-
threads = thread_map__new(-1, getpid(), UINT_MAX);
91+
threads = thread_map__new_by_tid(getpid());
9292
if (threads == NULL) {
9393
pr_debug("failed to call thread_map__new\n");
9494
return -1;

tools/perf/tests/keep-tracking.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ static int test__keep_tracking(struct test_suite *test __maybe_unused, int subte
7878
int found, err = -1;
7979
const char *comm;
8080

81-
threads = thread_map__new(-1, getpid(), UINT_MAX);
81+
threads = thread_map__new_by_tid(getpid());
8282
CHECK_NOT_NULL__(threads);
8383

8484
cpus = perf_cpu_map__new_online_cpus();

tools/perf/tests/mmap-basic.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ static int test__basic_mmap(struct test_suite *test __maybe_unused, int subtest
4646
char sbuf[STRERR_BUFSIZE];
4747
struct mmap *md;
4848

49-
threads = thread_map__new(-1, getpid(), UINT_MAX);
49+
threads = thread_map__new_by_tid(getpid());
5050
if (threads == NULL) {
5151
pr_debug("thread_map__new\n");
5252
return -1;

tools/perf/tests/openat-syscall-all-cpus.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ static int test__openat_syscall_event_on_all_cpus(struct test_suite *test __mayb
2828
struct evsel *evsel;
2929
unsigned int nr_openat_calls = 111, i;
3030
cpu_set_t cpu_set;
31-
struct perf_thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
31+
struct perf_thread_map *threads = thread_map__new_by_tid(getpid());
3232
char sbuf[STRERR_BUFSIZE];
3333
char errbuf[BUFSIZ];
3434

tools/perf/tests/openat-syscall.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ static int test__openat_syscall_event(struct test_suite *test __maybe_unused,
2020
int err = TEST_FAIL, fd;
2121
struct evsel *evsel;
2222
unsigned int nr_openat_calls = 111, i;
23-
struct perf_thread_map *threads = thread_map__new(-1, getpid(), UINT_MAX);
23+
struct perf_thread_map *threads = thread_map__new_by_tid(getpid());
2424
char sbuf[STRERR_BUFSIZE];
2525
char errbuf[BUFSIZ];
2626

tools/perf/tests/perf-time-to-tsc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ static int test__perf_time_to_tsc(struct test_suite *test __maybe_unused, int su
9090
struct mmap *md;
9191

9292

93-
threads = thread_map__new(-1, getpid(), UINT_MAX);
93+
threads = thread_map__new_by_tid(getpid());
9494
CHECK_NOT_NULL__(threads);
9595

9696
cpus = perf_cpu_map__new_online_cpus();

tools/perf/tests/switch-tracking.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -351,7 +351,7 @@ static int test__switch_tracking(struct test_suite *test __maybe_unused, int sub
351351
const char *comm;
352352
int err = -1;
353353

354-
threads = thread_map__new(-1, getpid(), UINT_MAX);
354+
threads = thread_map__new_by_tid(getpid());
355355
if (!threads) {
356356
pr_debug("thread_map__new failed!\n");
357357
goto out_err;

tools/perf/tests/thread-map.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ static int test__thread_map_remove(struct test_suite *test __maybe_unused, int s
115115
TEST_ASSERT_VAL("failed to allocate map string",
116116
asprintf(&str, "%d,%d", getpid(), getppid()) >= 0);
117117

118-
threads = thread_map__new_str(str, NULL, 0, false);
118+
threads = thread_map__new_str(str, /*tid=*/NULL, /*all_threads=*/false);
119119
free(str);
120120

121121
TEST_ASSERT_VAL("failed to allocate thread_map",

tools/perf/util/evlist.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,7 @@ int evlist__create_maps(struct evlist *evlist, struct target *target)
10061006
* per-thread data. thread_map__new_str will call
10071007
* thread_map__new_all_cpus to enumerate all threads.
10081008
*/
1009-
threads = thread_map__new_str(target->pid, target->tid, UINT_MAX, all_threads);
1009+
threads = thread_map__new_str(target->pid, target->tid, all_threads);
10101010

10111011
if (!threads)
10121012
return -1;

tools/perf/util/python.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -566,14 +566,14 @@ struct pyrf_thread_map {
566566
static int pyrf_thread_map__init(struct pyrf_thread_map *pthreads,
567567
PyObject *args, PyObject *kwargs)
568568
{
569-
static char *kwlist[] = { "pid", "tid", "uid", NULL };
570-
int pid = -1, tid = -1, uid = UINT_MAX;
569+
static char *kwlist[] = { "pid", "tid", NULL };
570+
int pid = -1, tid = -1;
571571

572-
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|iii",
573-
kwlist, &pid, &tid, &uid))
572+
if (!PyArg_ParseTupleAndKeywords(args, kwargs, "|ii",
573+
kwlist, &pid, &tid))
574574
return -1;
575575

576-
pthreads->threads = thread_map__new(pid, tid, uid);
576+
pthreads->threads = thread_map__new(pid, tid);
577577
if (pthreads->threads == NULL)
578578
return -1;
579579
return 0;

0 commit comments

Comments
 (0)