1

在我用 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.

即使没有严重的页面错误,如此高的挂起时间可能是什么原因?

4

1 回答 1

2

因为您的代码花费大量时间进行磁盘 I/O 和“等待”:

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.

所有这些活动(除了“进程没有不自觉地切换上下文”)都表明您的进程正在等待硬盘交付或承担某些事情。

此外,您的代码在内核模式下花费更多时间而不是在用户模式下,这也表明您的代码正在执行大量磁盘 I/O(或其他 I/O)。

于 2013-08-01T10:09:08.463 回答