Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Tracing pthread scheduling

What I want to do is create some kind of graph detailing the execution of (two) threads in Linux. I don't need to see what the threads do, just when they are scheduled and for how long, a time line basically.

I've spend the last few hours searching the internet for a way to trace the scheduling of pthreads. Unfortunately, the two projects I found require either kernel recompilation (LTTng) or glibc patching (NPTL Trace Tool), both of which I can not do (large, centrally managed system, on which I have no sudo rights).

Is there any other way to do something like this or will I have to resort to finding a laptop on which I can patch/recompile whatever I want?

Best regards

PS: I would have linked to both projects, but the site doesn't allow me (reputation < 10). The first search result on Google for the project names is the correct one though.

like image 766
AVH Avatar asked Jan 29 '10 16:01

AVH


2 Answers

Superuser privileges are not needed to build an instrumented glibc / libpthread.so. The ptt_trace program that is part of NPTL Trace Tool will run your program using the instrumented library.

like image 124
mark4o Avatar answered Oct 14 '22 03:10

mark4o


Maybe something like Intel's VTune?

like image 1
Douglas Leeder Avatar answered Oct 14 '22 02:10

Douglas Leeder