【发布时间】:2013-08-01 08:40:18
【问题描述】:
在我用 C++ 编写的应用程序中,我得到了以下时间信息。
0.46u CPU user time
1.27s CPU kernel time
41.83s Real wall clock
4% CPU% usage.
0 Major page faults
207848 No. of file system outputs.
100269 minor page faults.
82: No. of times the process was context switched involuntarily.
1297 No. of times that the program was context-switched.
即使没有严重的页面错误,如此高的挂起时间是什么原因?
【问题讨论】:
-
如果您不向我们展示您的代码/逻辑,我们怎么知道?
-
你在里面睡了几个?
-
显示代码。您的应用程序是否在执行大量磁盘 IO?
-
Major page fault 为 0,表示没有磁盘 IO。如果我错了,请纠正我。
-
这可能看起来有点明显,但该过程是否进行任何输入。特别是键盘输入。一个简单的
std::getline( std::cin, line )可能会花费数小时的挂钟时间,而没有 CPU 则如此。
标签: c++ linux page-fault cpu-time