switch to IO::File and explicit flush for the engine log.

should be slightly faster
This commit is contained in:
espie 2013-01-04 19:34:10 +00:00
parent 64b2cd78df
commit a9b8de6833
3 changed files with 18 additions and 5 deletions

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Engine.pm,v 1.67 2013/01/04 12:06:25 espie Exp $
# $OpenBSD: Engine.pm,v 1.68 2013/01/04 19:34:10 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -215,6 +215,7 @@ sub end
}
}
$self->done($v);
$self->{engine}->flush;
}
sub dump
@ -416,7 +417,7 @@ sub new
if ($state->{want_fetchinfo}) {
$o->{tofetch} = DPB::SubEngine::Fetch->new($o);
}
$o->{log} = DPB::Util->make_hot($state->logger->open("engine"));
$o->{log} = $state->logger->open("engine");
$o->{stats} = DPB::Util->make_hot($state->logger->open("stats"));
return $o;
}
@ -446,6 +447,12 @@ sub log
$self->log_no_ts(@_);
}
sub flush
{
my $self = shift;
$self->{log}->flush;
}
sub count
{
my ($self, $field) = @_;
@ -714,6 +721,7 @@ sub check_buildable
sub {
1 while $self->adjust_built;
$self->adjust_tobuild;
$self->flush;
});
$self->stats;
return $r;
@ -809,12 +817,14 @@ sub start_new_job
{
my $self = shift;
$self->{buildable}->start;
$self->flush;
}
sub start_new_fetch
{
my $self = shift;
$self->{tofetch}->start;
$self->flush;
}
sub can_build

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Grabber.pm,v 1.24 2012/01/30 15:11:04 espie Exp $
# $OpenBSD: Grabber.pm,v 1.25 2013/01/04 19:34:10 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -67,6 +67,7 @@ sub finish
$self->{engine}->new_path($v);
}
}
$self->{engine}->flush;
$self->{keepgoing} = &{$self->{endcode}};
}
@ -147,6 +148,7 @@ sub complete_subdirs
$v->{tried} = 1;
}
}
$self->{engine}->flush;
last if (keys %$subdirlist) == 0;
DPB::Vars->grab_list($core, $self, $subdirlist,

View File

@ -1,5 +1,5 @@
# ex:ts=8 sw=4:
# $OpenBSD: Logger.pm,v 1.9 2012/10/11 07:38:38 espie Exp $
# $OpenBSD: Logger.pm,v 1.10 2013/01/04 19:34:10 espie Exp $
#
# Copyright (c) 2010 Marc Espie <espie@openbsd.org>
#
@ -21,6 +21,7 @@ use warnings;
package DPB::Logger;
use File::Path;
use File::Basename;
use IO::File;
sub new
{
@ -40,7 +41,7 @@ sub _open
{
my ($self, $mode, $name) = @_;
my $log = $self->logfile($name);
CORE::open my $fh, $mode, $log or die "Can't write to $log: $!\n";
my $fh = IO::File->new($log, $mode) or die "Can't write to $log: $!\n";
return $fh;
}