作者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