views:

201

answers:

3

Hi,

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.

+1  A: 

Maybe something like Intel's VTune?

Douglas Leeder
This looks very promising, I will keep this in mind for the future when I'm able to afford that software package.
Darhuuk
I just tried the evaluation version and unless I'm overlooking something, there's no way to get a graphical trace of the threads in the Linux version, a shame really. Basically the Linux version is an expensive version of Helgrind (http://valgrind.org/docs/manual/hg-manual.html).
Darhuuk
That's a pity - I've never tried it, but thought it looked interesting - the graphs are pretty, but if the Linux version can't generated them, then it's not very interesting.
Douglas Leeder
+3  A: 

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.

mark4o
Thank you for mentioning this. I took another look at NPTL TT, but it seems the project hasn't been worked on since 2006 and patching new glibc versions doesn't seem to work.
Darhuuk
A: 

There is also a tool called pthreadw (on sourceforge)

It's a wrapper library which intercepts calls to the usual functions of the pthread library, and reports stats, like typical times spent playing with locks, condition variables, etc... It is not currently able to export traces, only textual summary reports.

bluzorange