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

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@14841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
tadf 2008-01-02 01:15:30 +00:00
Родитель dec7f6903b
Коммит 1f838ea1c1
2 изменённых файлов: 14 добавлений и 6 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Wed Jan 2 10:13:54 2008 Tadayoshi Funaba <tadf@dotrb.org>
* sample/time.rb: use Process.times instead of Time.times.
Wed Jan 2 09:09:53 2008 Tadayoshi Funaba <tadf@dotrb.org> Wed Jan 2 09:09:53 2008 Tadayoshi Funaba <tadf@dotrb.org>
* sample/goodfriday.rb: examples for date are enough. retired. * sample/goodfriday.rb: examples for date are enough. retired.

Просмотреть файл

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