我计划很快购买新的 Mac 桌面,我想知道 CPU、RAM 还是我的硬盘驱动器是我的脚本的瓶颈。
我在 Ubuntu 12.04 上使用 Ruby 1.9.3 运行了我的主要单元测试,并获得了以下信息:
$ date; /usr/bin/time --verbose ruby1.9.1 test/test_all.rb ; date
Mon May 7 15:04:38 EST 2012
Run options:
# Running tests:
[snip 705 dots]
Finished tests in 50.672999s, 13.9127 tests/s, 49.1781 assertions/s.
705 tests, 2492 assertions, 0 failures, 0 errors, 0 skips
Command being timed: "ruby1.9.1 test/test_all.rb"
User time (seconds): 29.25
System time (seconds): 5.26
Percent of CPU this job got: 67%
Elapsed (wall clock) time (h:mm:ss or m:ss): 0:51.01
Average shared text size (kbytes): 0
Average unshared data size (kbytes): 0
Average stack size (kbytes): 0
Average total size (kbytes): 0
Maximum resident set size (kbytes): 238592
Average resident set size (kbytes): 0
Major (requiring I/O) page faults: 0
Minor (reclaiming a frame) page faults: 4180160
Voluntary context switches: 31187
Involuntary context switches: 12397
Swaps: 0
File system inputs: 0
File system outputs: 224
Socket messages sent: 0
Socket messages received: 0
Signals delivered: 0
Page size (bytes): 4096
Exit status: 0
Mon May 7 15:05:29 EST 2012
由于用户加系统所花费的时间少于挂墙时间,我认为 CPU 不是唯一的瓶颈。我怎样才能弄清楚还有什么瓶颈?