跟踪pthread调度 [英] Tracing pthread scheduling
问题描述
我想做的是创建某种图形,详细描述Linux中(两个)线程的执行情况.我不需要看线程在做什么,只需要安排它们的时间,基本上就可以看到一个时间表.
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.
我花了最后几个小时在互联网上搜索一种跟踪pthread调度的方法.不幸的是,我发现的两个项目都需要重新编译内核( LTTng )或glibc修补
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?
最诚挚的问候
PS:我本来可以链接到这两个项目,但该网站不允许我这样做(声誉<10).不过,在Google上第一个搜索到的项目名称是正确的搜索结果.
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.
推荐答案
构建检测的glibc/libpthread.so不需要超级用户特权. ptt_trace
程序,它是
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.
这篇关于跟踪pthread调度的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!