Pedantry: CLOCK_REALTIME -> CLOCK_MONOTONIC

This commit is contained in:
Eelco Dolstra 2017-02-21 15:49:01 +01:00
parent 53b1f7da64
commit 7081f97f3a
No known key found for this signature in database
GPG key ID: 8170B4726D7198DE

View file

@ -13,7 +13,7 @@ use Config::General;
use Data::Dump qw(dump); use Data::Dump qw(dump);
use Try::Tiny; use Try::Tiny;
use Net::Statsd; use Net::Statsd;
use Time::HiRes qw(clock_gettime CLOCK_REALTIME); use Time::HiRes qw(clock_gettime CLOCK_MONOTONIC);
use JSON; use JSON;
use File::Slurp; use File::Slurp;
@ -124,14 +124,14 @@ sub checkJobsetWrapped {
my $exprType = $jobset->nixexprpath =~ /.scm$/ ? "guile" : "nix"; my $exprType = $jobset->nixexprpath =~ /.scm$/ ? "guile" : "nix";
# Fetch all values for all inputs. # Fetch all values for all inputs.
my $checkoutStart = clock_gettime(CLOCK_REALTIME); my $checkoutStart = clock_gettime(CLOCK_MONOTONIC);
eval { eval {
fetchInputs($project, $jobset, $inputInfo); fetchInputs($project, $jobset, $inputInfo);
}; };
my $fetchError = $@; my $fetchError = $@;
Net::Statsd::increment("hydra.evaluator.checkouts"); Net::Statsd::increment("hydra.evaluator.checkouts");
my $checkoutStop = clock_gettime(CLOCK_REALTIME); my $checkoutStop = clock_gettime(CLOCK_MONOTONIC);
Net::Statsd::timing("hydra.evaluator.checkout_time", int(($checkoutStop - $checkoutStart) * 1000)); Net::Statsd::timing("hydra.evaluator.checkout_time", int(($checkoutStop - $checkoutStart) * 1000));
if ($fetchError) { if ($fetchError) {
@ -159,9 +159,9 @@ sub checkJobsetWrapped {
} }
# Evaluate the job expression. # Evaluate the job expression.
my $evalStart = clock_gettime(CLOCK_REALTIME); my $evalStart = clock_gettime(CLOCK_MONOTONIC);
my ($jobs, $nixExprInput) = evalJobs($inputInfo, $exprType, $jobset->nixexprinput, $jobset->nixexprpath); my ($jobs, $nixExprInput) = evalJobs($inputInfo, $exprType, $jobset->nixexprinput, $jobset->nixexprpath);
my $evalStop = clock_gettime(CLOCK_REALTIME); my $evalStop = clock_gettime(CLOCK_MONOTONIC);
if ($jobsetsJobset) { if ($jobsetsJobset) {
my @keys = keys %$jobs; my @keys = keys %$jobs;
@ -186,7 +186,7 @@ sub checkJobsetWrapped {
my $jobOutPathMap = {}; my $jobOutPathMap = {};
my $jobsetChanged = 0; my $jobsetChanged = 0;
my $dbStart = clock_gettime(CLOCK_REALTIME); my $dbStart = clock_gettime(CLOCK_MONOTONIC);
txn_do($db, sub { txn_do($db, sub {
@ -282,7 +282,7 @@ sub checkJobsetWrapped {
$jobset->update({ lastcheckedtime => time, forceeval => undef }); $jobset->update({ lastcheckedtime => time, forceeval => undef });
}); });
my $dbStop = clock_gettime(CLOCK_REALTIME); my $dbStop = clock_gettime(CLOCK_MONOTONIC);
Net::Statsd::timing("hydra.evaluator.db_time", int(($dbStop - $dbStart) * 1000)); Net::Statsd::timing("hydra.evaluator.db_time", int(($dbStop - $dbStart) * 1000));
Net::Statsd::increment("hydra.evaluator.evals"); Net::Statsd::increment("hydra.evaluator.evals");
@ -310,14 +310,14 @@ sub checkJobset {
my $triggerTime = $jobset->triggertime; my $triggerTime = $jobset->triggertime;
my $startTime = clock_gettime(CLOCK_REALTIME); my $startTime = clock_gettime(CLOCK_MONOTONIC);
eval { eval {
checkJobsetWrapped($jobset); checkJobsetWrapped($jobset);
}; };
my $checkError = $@; my $checkError = $@;
my $stopTime = clock_gettime(CLOCK_REALTIME); my $stopTime = clock_gettime(CLOCK_MONOTONIC);
Net::Statsd::timing("hydra.evaluator.total_time", int(($stopTime - $startTime) * 1000)); Net::Statsd::timing("hydra.evaluator.total_time", int(($stopTime - $startTime) * 1000));
my $failed = 0; my $failed = 0;