(minor) add quick and dirty timer code to Common.pm
This commit is contained in:
parent
8a9564f171
commit
d491b5384f
|
@ -14,6 +14,8 @@ package Gitolite::Common;
|
|||
gl_log
|
||||
|
||||
dd
|
||||
t_start
|
||||
t_lap
|
||||
);
|
||||
#>>>
|
||||
use Exporter 'import';
|
||||
|
@ -70,6 +72,21 @@ sub dd {
|
|||
dbg(@_);
|
||||
}
|
||||
|
||||
{
|
||||
use Time::HiRes;
|
||||
my %start_times;
|
||||
|
||||
sub t_start {
|
||||
my $name = shift || 'default';
|
||||
$start_times{$name} = [ Time::HiRes::gettimeofday() ];
|
||||
}
|
||||
|
||||
sub t_lap {
|
||||
my $name = shift || 'default';
|
||||
return Time::HiRes::tv_interval( $start_times{$name} );
|
||||
}
|
||||
}
|
||||
|
||||
sub _warn {
|
||||
gl_log( 'warn', @_ );
|
||||
if ( $ENV{D} and $ENV{D} >= 3 ) {
|
||||
|
|
Loading…
Reference in a new issue