, - , R, , Excel - (CSV ). - . Perl 5,7 ( Time: HiRes ), syscall, , Time:: HiRes .
INIT {
sub wrap_sub {
no strict 'refs';
my $sub = shift;
my $subref = *{$sub}{CODE};
return sub {
local *__ANON__ = "wrapped_$sub";
my $fsecs = Time::HiRes::gettimeofday();
print STDERR "$sub,$fsecs,";
if (wantarray) {
@return = eval { $subref->(@_) } or die $@;
} else {
$return[0] = eval { $subref->(@_) } or die $@;
}
$fsecs = Time::HiRes::gettimeofday();
print STDERR "$fsecs\n";
return wantarray ? @return : $return[0];
};
}
require Time::HiRes;
my @subs = qw{the subs you want to profile};
no strict 'refs';
no warnings 'redefine';
foreach my $sub (@subs) {
*{$sub} = wrap_sub($sub);
}
}
", " , , open() ed file STDERR, , , script ( Unix, bourne, korn bash),
perl ./myscript.pl 2>myscript.profile