diff options
| author | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-02 01:15:30 +0000 |
|---|---|---|
| committer | tadf <tadf@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2008-01-02 01:15:30 +0000 |
| commit | 68c53910dc0246b8881df6f6177d9794a87ce44b (patch) | |
| tree | 1c6b255abe3966420bc9aecdddb5aff711db4433 /sample | |
| parent | 9dc8e25c3acff4e027418f9cdfb9a745d29259fc (diff) | |
| download | ruby-68c53910dc0246b8881df6f6177d9794a87ce44b.tar.gz ruby-68c53910dc0246b8881df6f6177d9794a87ce44b.tar.xz ruby-68c53910dc0246b8881df6f6177d9794a87ce44b.zip | |
* sample/time.rb: use Process.times instead of Time.times.
git-svn-id: http://svn.ruby-lang.org/repos/ruby/trunk@14841 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'sample')
| -rw-r--r-- | sample/time.rb | 16 |
1 files changed, 10 insertions, 6 deletions
diff --git a/sample/time.rb b/sample/time.rb index 84fa9e1a8..e16912052 100644 --- a/sample/time.rb +++ b/sample/time.rb @@ -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) |
