nnnmmm
nnnmmm

Reputation: 8804

How do I sample all threads and record their thread id with perf?

I want to get information about what each thread is doing at regular intervals. Unfortunately I can see in the perf script output that no thread id is recorded, because the output looks the same with -F +tid as with -F -tid.

I tried using the --per-thread option but it doesn't do what I want. Instead, it seems to drop the timestamp field from the data.

Is this possible? If not, what does the data reported by perf for a multithreaded program mean – does it just sample the main thread, or random threads?

Upvotes: 0

Views: 1613

Answers (1)

nnnmmm
nnnmmm

Reputation: 8804

As it turns out, perf record already records threads and their ID. What got me confused is that the thread ID of the main thread is equal to the process ID. I also must have been doing something wrong when doing the -F -tid test, because indeed the column with the thread ID disappears.

Upvotes: 2

Related Questions