Changeset 8154 for lang/perl/App-MadEye

Show
Ignore:
Timestamp:
03/19/08 20:07:45 (9 months ago)
Author:
tokuhirom
Message:

added stopwatch

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • lang/perl/App-MadEye/trunk/lib/App/MadEye/Util.pm

    r8149 r8154  
    1010use List::Util qw/first/; 
    1111use YAML (); 
     12use Time::HiRes qw/gettimeofday/; 
    1213 
    1314sub timeout($$&) {    ## no critic. 
     
    1819        local $SIG{ALRM} = sub { die "Time out error: $msg" }; 
    1920        $last_alarm = alarm $secs; 
    20         $code->(); 
     21 
     22        my $start_time = gettimeofday(); 
     23            $code->(); 
     24        App::MadEye->context->log('debug' => "stopwatch: " . (gettimeofday() - $start_time)); 
    2125    }; 
    2226    if ($@) {