test-driver: Logs time taken for nests
This commit is contained in:
parent
1fe0018df8
commit
5d93e2c01c
1 changed files with 3 additions and 0 deletions
|
@ -4,6 +4,7 @@ use strict;
|
||||||
use Thread::Queue;
|
use Thread::Queue;
|
||||||
use XML::Writer;
|
use XML::Writer;
|
||||||
use Encode qw(decode encode);
|
use Encode qw(decode encode);
|
||||||
|
use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
|
||||||
|
|
||||||
sub new {
|
sub new {
|
||||||
my ($class) = @_;
|
my ($class) = @_;
|
||||||
|
@ -46,10 +47,12 @@ sub nest {
|
||||||
print STDERR maybePrefix("$msg\n", $attrs);
|
print STDERR maybePrefix("$msg\n", $attrs);
|
||||||
$self->{log}->startTag("nest");
|
$self->{log}->startTag("nest");
|
||||||
$self->{log}->dataElement("head", $msg, %{$attrs});
|
$self->{log}->dataElement("head", $msg, %{$attrs});
|
||||||
|
my $now = clock_gettime(CLOCK_MONOTONIC);
|
||||||
$self->drainLogQueue();
|
$self->drainLogQueue();
|
||||||
eval { &$coderef };
|
eval { &$coderef };
|
||||||
my $res = $@;
|
my $res = $@;
|
||||||
$self->drainLogQueue();
|
$self->drainLogQueue();
|
||||||
|
$self->log(sprintf("(%.2f seconds)", clock_gettime(CLOCK_MONOTONIC) - $now));
|
||||||
$self->{log}->endTag("nest");
|
$self->{log}->endTag("nest");
|
||||||
die $@ if $@;
|
die $@ if $@;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue