作者omusico (omusico)
看板Ruby
标题[问题] 在ruby下的sample的time指令
时间Wed Aug 2 19:48:10 2006
请问一下这一个是用来测试执行时间吗
time.rb
#! /usr/local/bin/ruby
cmd = ARGV.join(" ")
b = Time.now
system(cmd)
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
--
※ 发信站: 批踢踢实业坊(ptt.cc)
◆ From: 222.250.106.144
1F:推 WanCW:是的,他会印出程式执行花费的时间 08/02 21:24