Valgrind callgrind 使用总时间还是“执行时间”?创建数据
我遇到一个问题,我的应用程序随线程数量线性扩展(认为 800 个线程的性能是双核 CPU 上 400 个线程的性能的两倍)。我的直觉告诉我线程正在休眠或被阻塞......但我在 callgrind 中看不到它。
callgrind 也测量函数时间,或者仅测量线程创建数据的活动时间。如果不清楚我问的是什么...线程执行
i ++;
2 秒,那么
sleep(1);//thread will not be scheduled to run for min 1 second...
...将 i++
大约占调用图的 100% 或大约 66%。
I have a problem where my application scales linearly with the number of threads(think 800 threads gives doubly the performance of 400 threads on dual core CPU). And my gut feeling is telling me that threads are sleeping or are being blocked... but I cant see it in callgrind.
So does callgrind measure function time, or just the time that thread was active to create data. If it is not clear what I ask... thread does
i ++;
for 2 seconds, then
sleep(1);//thread will not be scheduled to run for min 1 second...
... will i++
be approximately 100% or approximately 66% of the call graph.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
Valgrind 收集用户时间统计数据,而不是实时统计数据。因此,如果线程相互中断,您将不会在 Valgrind 中看到它。您将得到的只是执行每个函数所花费的实际时间。
Valgrind collects user time statistics, not real time statistics. So if threads are interrupting each other, you won't see it in Valgrind. All you will get is the actual time spent executing each function.