Perlプログラムに関する各種メモ書き

プログラムの実行時間の計測

■ アバウトなプログラム実行時間の取得

my($starttimes_user) = (times())[0];
# 実行時間を計測したい処理をここに記述
my($endtimes_user) = (times())[0];
my $exectimes_user=$endtimes_user-$starttimes_user;
print "[$exectimes_user]秒";

■ 詳細なプログラム実行時間の取得

use Time::HiRes qw(gettimeofday);
my ($sec, $microsec) = gettimeofday;
printf "%d %d?n", $sec, $microsec;

関連エントリー

No.69
03/26 13:59

edit

perlモジュール