为什么gprof低估了总时间 [英] Why gprof underestimates total time

查看:114
本文介绍了为什么gprof低估了总时间的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有CPU绑定进程,该进程运行5个小时(使用getrusage()可以节省CPU时间)

I have CPU bound process which runs for 5 hours (CPU time by using getrusage())

我尝试通过gprof对其进行分析. main()花费的总时间仅为5000s.

I tried to profile it by gprof. The total time main() took is only about 5000s.

我的程序受CPU限制,它具有一些光盘IO,但意义不大.配置文件中断已打开,并且我的进程未处于多线程状态.

My program is CPU bound, it has some disc IO but it is not that significant. Profile interrupts are on, and my process in not multithreaded.

推荐答案

它仅在已知的例程中进行采样.您打new吗?那会花时间在gprof没去的地方.

It only samples in routines it knows about. You calling new? That's going to spend time in places where gprof doesn't go.

顺便说一句,如果您正在寻找节省时间的方法(5小时后我会)

BTW, if you're looking for ways to save some time (after 5 hours I would be) you can do better.

这篇关于为什么gprof低估了总时间的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆