explicitly call CORE::time/ Time::HiRes::time everywhere
(some to be revisited to use Time::HiRes)
This commit is contained in:
parent
31adf50b1c
commit
53deb25c6d
@ -1,7 +1,7 @@
|
||||
#! /usr/bin/perl
|
||||
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: dpb,v 1.135 2019/10/22 15:50:25 espie Exp $
|
||||
# $OpenBSD: dpb,v 1.136 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -77,9 +77,10 @@ sub show_duration
|
||||
sub report_tty
|
||||
{
|
||||
my ($self, $state) = @_;
|
||||
return DPB::Util->time2string(time)." [$$]".
|
||||
my $t = CORE::time();
|
||||
return DPB::Util->time2string($t)." [$$]".
|
||||
($keep_going ? "" : " STOPPED!").
|
||||
" running for ".show_duration(time-$state->{starttime})."\n";
|
||||
" running for ".show_duration($t-$state->{starttime})."\n";
|
||||
}
|
||||
|
||||
sub affinityclass
|
||||
@ -238,7 +239,7 @@ sub handle_non_waiting_jobs
|
||||
last;
|
||||
}
|
||||
}
|
||||
DPB::Core->log_concurrency(time(), $state->{concurrent});
|
||||
DPB::Core->log_concurrency(CORE::time(), $state->{concurrent});
|
||||
DPB::Core->wake_jobs;
|
||||
$reporter->report($force_report);
|
||||
}
|
||||
@ -342,7 +343,7 @@ if ($state->{scan_only}) {
|
||||
$reporter->reset;
|
||||
DPB::Core->cleanup;
|
||||
$state->{external}->cleanup;
|
||||
print "Elapsed time=", show_duration(time-$state->{starttime}),"\n";
|
||||
print "Elapsed time=", show_duration(CORE::time()-$state->{starttime}),"\n";
|
||||
print $state->engine->report_tty($state);
|
||||
$state->engine->end_dump($state->logger->append('dump'));
|
||||
$state->engine->smart_dump($state->logger->append('summary'));
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Fetch.pm,v 1.80 2018/07/15 09:56:45 espie Exp $
|
||||
# $OpenBSD: Fetch.pm,v 1.81 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -155,7 +155,7 @@ sub parse_old
|
||||
sub expire_old
|
||||
{
|
||||
my $self = shift;
|
||||
my $ts = time();
|
||||
my $ts = CORE::time();
|
||||
my $distdir = $self->distdir;
|
||||
chdir($distdir) or die "can't change to distdir: $!";
|
||||
my $fh2 = $self->open(">", "history.new");
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Heuristics.pm,v 1.33 2019/10/22 15:44:10 espie Exp $
|
||||
# $OpenBSD: Heuristics.pm,v 1.34 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -202,7 +202,7 @@ sub done
|
||||
sub report_tty
|
||||
{
|
||||
my ($self, $state) = @_;
|
||||
my $time = time;
|
||||
my $time = CORE::time();
|
||||
return DPB::Util->time2string($time)." [$$]\n";
|
||||
# okay, I need to sit down and do the actual computation, sigh.
|
||||
my $all = DPB::Core->all_sf;
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Port.pm,v 1.195 2019/08/30 17:56:55 espie Exp $
|
||||
# $OpenBSD: Port.pm,v 1.196 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -82,7 +82,8 @@ sub handle_output
|
||||
{
|
||||
my ($self, $job) = @_;
|
||||
$self->redirect_fh($job->{logfh}, $job->{log});
|
||||
print ">>> Running $self->{phase} in $job->{path} at ", time(), "\n";
|
||||
print ">>> Running $self->{phase} in $job->{path} at ",
|
||||
CORE::time(), "\n";
|
||||
}
|
||||
|
||||
sub tweak_args
|
||||
@ -354,7 +355,7 @@ sub try_lock
|
||||
if ($lock) {
|
||||
$lock->write("path", $job->{path});
|
||||
print {$job->{logfh}} "(Junk lock obtained for ",
|
||||
$core->hostname, " at ", time(), ")\n";
|
||||
$core->hostname, " at ", CORE::time(), ")\n";
|
||||
$job->{locked} = 1;
|
||||
}
|
||||
}
|
||||
@ -366,7 +367,7 @@ sub junk_unlock
|
||||
if ($core->job->{locked}) {
|
||||
$core->job->{builder}->locker->unlock($core);
|
||||
print {$core->job->{logfh}} "(Junk lock released for ",
|
||||
$core->hostname, " at ", time(), ")\n";
|
||||
$core->hostname, " at ", CORE::time(), ")\n";
|
||||
delete $core->job->{locked};
|
||||
$core->job->wake_others($core);
|
||||
}
|
||||
@ -403,19 +404,20 @@ sub run
|
||||
my ($self, $core) = @_;
|
||||
my $job = $core->job;
|
||||
$SIG{IO} = sub { print {$job->{logfh}} "Received IO\n"; };
|
||||
my $date = time;
|
||||
my $start = CORE::time();
|
||||
use POSIX;
|
||||
|
||||
while (1) {
|
||||
$self->try_lock($core);
|
||||
my $now = CORE::time();
|
||||
if ($job->{locked}) {
|
||||
print {$job->{builder}{lockperf}}
|
||||
time(), ":", $core->hostname,
|
||||
": $self->{phase}: ", time() - $date, " seconds\n";
|
||||
$now, ":", $core->hostname,
|
||||
": $self->{phase}: ", $now - $start, " seconds\n";
|
||||
exit(0);
|
||||
}
|
||||
print {$job->{logfh}} "(Junk lock failure for ",
|
||||
$core->hostname, " at ", time(), ")\n";
|
||||
$core->hostname, " at ", $now, ")\n";
|
||||
pause;
|
||||
}
|
||||
}
|
||||
@ -779,7 +781,7 @@ sub finalize
|
||||
pkgpath => $job->{path},
|
||||
pkname => $job->{v}->fullpkgname,
|
||||
size => $sz,
|
||||
ts => CORE::time });
|
||||
ts => CORE::time() });
|
||||
print {$job->{builder}{logsize}} $info, "\n";
|
||||
# XXX the rolling log might be shared with other dpb
|
||||
# so it can be rewritten and sorted
|
||||
@ -939,7 +941,7 @@ sub close
|
||||
package DPB::Job::BasePort;
|
||||
our @ISA = qw(DPB::Job::Watched);
|
||||
|
||||
use Time::HiRes qw(time);
|
||||
use Time::HiRes;
|
||||
|
||||
sub killinfo
|
||||
{
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Limiter.pm,v 1.7 2015/05/10 08:14:14 espie Exp $
|
||||
# $OpenBSD: Limiter.pm,v 1.8 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -22,7 +22,7 @@ use warnings;
|
||||
# this is a mixin-class.
|
||||
|
||||
package DPB::Limiter;
|
||||
use Time::HiRes qw(time);
|
||||
use Time::HiRes;
|
||||
use DPB::Util;
|
||||
use DPB::Clock;
|
||||
|
||||
@ -37,7 +37,7 @@ sub setup
|
||||
sub limit
|
||||
{
|
||||
my ($self, $forced, $factor, $tag, $cond, $code) = @_;
|
||||
$self->{ts} = time();
|
||||
$self->{ts} = Time::HiRes::time();
|
||||
$self->{start} = 0; # so we can register ourselves
|
||||
$self->{next_check} //= $self->{ts};
|
||||
DPB::Clock->register($self);
|
||||
@ -51,9 +51,9 @@ sub limit
|
||||
|
||||
delete $self->{unchecked};
|
||||
# actual computation
|
||||
$self->{start} = time();
|
||||
$self->{start} = Time::HiRes::time();
|
||||
&$code;
|
||||
$self->{end} = time();
|
||||
$self->{end} = Time::HiRes::time();
|
||||
# adjust values for next time
|
||||
my $check_interval = $factor * ($self->{end} - $self->{start});
|
||||
my $offset = $self->{ts} - $self->{next_check};
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: PortBuilder.pm,v 1.85 2019/05/12 14:09:11 espie Exp $
|
||||
# $OpenBSD: PortBuilder.pm,v 1.86 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -181,7 +181,7 @@ sub report
|
||||
if ($job->{failed}) {
|
||||
my $fh = $self->logger->open('>>', $job->{log});
|
||||
print $fh "Error: job failed with $job->{failed} on ",
|
||||
$core->hostname, " at ", time(), "\n" if defined $fh;
|
||||
$core->hostname, " at ", CORE::time(), "\n" if defined $fh;
|
||||
print $log "!\n";
|
||||
} else {
|
||||
print $log "\n";
|
||||
@ -194,7 +194,7 @@ sub report
|
||||
host => $host,
|
||||
time => $job->totaltime,
|
||||
size => $sz,
|
||||
ts => CORE::time }), "\n";
|
||||
ts => CORE::time() }), "\n";
|
||||
}
|
||||
}
|
||||
|
||||
@ -207,7 +207,7 @@ sub get
|
||||
sub end_lock
|
||||
{
|
||||
my ($self, $lock, $core, $job) = @_;
|
||||
my $end = time();
|
||||
my $end = CORE::time();
|
||||
$lock->write("status", $core->{status});
|
||||
$lock->write("todo", $job->current_task);
|
||||
$lock->write("end", "$end (".DPB::Util->time2string($end).")");
|
||||
@ -217,7 +217,7 @@ sub end_lock
|
||||
sub build
|
||||
{
|
||||
my ($self, $v, $core, $lock, $final_sub) = @_;
|
||||
my $start = time();
|
||||
my $start = CORE::time();
|
||||
my ($log, $fh) = $self->logger->make_logs($v);
|
||||
my $memsize = $self->{sizer}->build_in_memory($fh, $core, $v);
|
||||
my $meminfo;
|
||||
@ -283,7 +283,6 @@ sub wipe
|
||||
sub force_junk
|
||||
{
|
||||
my ($self, $v, $core, $final_sub) = @_;
|
||||
my $start = time();
|
||||
my $log = $self->logger->log_pkgpath($v);
|
||||
my $fh = $self->logger->open('>>', $log);
|
||||
print $fh ">>> Force junking on ", $core->hostname;
|
||||
@ -301,7 +300,7 @@ sub force_junk
|
||||
sub test
|
||||
{
|
||||
my ($self, $v, $core, $lock, $final_sub) = @_;
|
||||
my $start = time();
|
||||
my $start = CORE::time();
|
||||
my $log = $self->logger->make_test_logs($v);
|
||||
my $memsize = $self->{sizer}->build_in_memory($core, $v);
|
||||
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: Tty.pm,v 1.8 2019/10/22 15:44:10 espie Exp $
|
||||
# $OpenBSD: Tty.pm,v 1.9 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -74,8 +74,8 @@ sub report
|
||||
$msg .= $extra;
|
||||
if ($msg ne $self->{msg} || $self->{continued}) {
|
||||
if (defined $self->{record}) {
|
||||
print {$self->{record}} "@@@", time(), "\n";
|
||||
print {$self->{record}} $msg;
|
||||
print {$self->{record}} "@@@",
|
||||
CORE::time(), "\n", $msg;
|
||||
}
|
||||
$self->{continued} = 0;
|
||||
my $method = $self->{write};
|
||||
|
@ -1,5 +1,5 @@
|
||||
# ex:ts=8 sw=4:
|
||||
# $OpenBSD: State.pm,v 1.27 2019/09/02 13:15:38 espie Exp $
|
||||
# $OpenBSD: State.pm,v 1.28 2019/10/22 16:02:08 espie Exp $
|
||||
#
|
||||
# Copyright (c) 2010-2013 Marc Espie <espie@openbsd.org>
|
||||
#
|
||||
@ -47,7 +47,7 @@ sub init
|
||||
$self->{no_exports} = 1;
|
||||
$self->{heuristics} = DPB::Heuristics->new($self);
|
||||
$self->{make} = $ENV{MAKE} || OpenBSD::Paths->make;
|
||||
$self->{starttime} = time();
|
||||
$self->{starttime} = CORE::time();
|
||||
$self->{master_pid} = $$;
|
||||
|
||||
return $self;
|
||||
|
Loading…
Reference in New Issue
Block a user