1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00

* sample/time.rb: use Process.times instead of Time.times.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@14842 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2008-01-02 01:19:41 +00:00
parent 7d7e2c6c11
commit 619d2e7302
2 changed files with 14 additions and 6 deletions

View file

@ -1,8 +1,12 @@
#! /usr/local/bin/ruby
cmd = ARGV.join(" ")
#! /usr/bin/env ruby
b = Time.now
system(cmd)
system(*ARGV)
e = Time.now
ut, st, cut, cst = Time.times.to_a
total = (e - b).to_f
STDERR.printf "%11.1f real %11.1f user %11.1f sys\n", total, cut, cst
tms = Process.times
real = e - b
user = tms.cutime
sys = tms.cstime
STDERR.printf("%11.1f real %11.1f user %11.1f sys\n", real, user, sys)