Keep track of how many threads are waiting

This commit is contained in:
Eelco Dolstra 2015-07-10 19:10:14 +02:00
parent 06d75699a7
commit 3ded87329d
4 changed files with 7 additions and 2 deletions

View file

@ -179,9 +179,11 @@ void State::buildRemote(std::shared_ptr<StoreAPI> store,
/* Copy the input closure. */ /* Copy the input closure. */
if (machine->sshName != "localhost") { if (machine->sshName != "localhost") {
printMsg(lvlDebug, format("sending closure of %1% to %2%") % step->drvPath % machine->sshName); auto mc1 = std::make_shared<MaintainCount>(nrStepsWaiting);
MaintainCount mc(nrStepsCopyingTo);
std::lock_guard<std::mutex> sendLock(machine->state->sendLock); std::lock_guard<std::mutex> sendLock(machine->state->sendLock);
mc1.reset();
MaintainCount mc2(nrStepsCopyingTo);
printMsg(lvlDebug, format("sending closure of %1% to %2%") % step->drvPath % machine->sshName);
copyClosureTo(store, from, to, inputs, bytesSent); copyClosureTo(store, from, to, inputs, bytesSent);
} }

View file

@ -1283,6 +1283,7 @@ void State::dumpStatus(Connection & conn, bool log)
root.attr("nrStepsBuilding", nrStepsBuilding); root.attr("nrStepsBuilding", nrStepsBuilding);
root.attr("nrStepsCopyingTo", nrStepsCopyingTo); root.attr("nrStepsCopyingTo", nrStepsCopyingTo);
root.attr("nrStepsCopyingFrom", nrStepsCopyingFrom); root.attr("nrStepsCopyingFrom", nrStepsCopyingFrom);
root.attr("nrStepsWaiting", nrStepsWaiting);
root.attr("bytesSent"); out << bytesSent; root.attr("bytesSent"); out << bytesSent;
root.attr("bytesReceived"); out << bytesReceived; root.attr("bytesReceived"); out << bytesReceived;
root.attr("nrBuildsRead", nrBuildsRead); root.attr("nrBuildsRead", nrBuildsRead);

View file

@ -203,6 +203,7 @@ private:
counter nrStepsBuilding{0}; counter nrStepsBuilding{0};
counter nrStepsCopyingTo{0}; counter nrStepsCopyingTo{0};
counter nrStepsCopyingFrom{0}; counter nrStepsCopyingFrom{0};
counter nrStepsWaiting{0};
counter nrRetries{0}; counter nrRetries{0};
counter maxNrRetries{0}; counter maxNrRetries{0};
counter totalStepTime{0}; // total time for steps, including closure copying counter totalStepTime{0}; // total time for steps, including closure copying

View file

@ -29,6 +29,7 @@ sub sendQueueRunnerStats {
gauge("hydra.queue.steps.building", $json->{nrStepsBuilding}); gauge("hydra.queue.steps.building", $json->{nrStepsBuilding});
gauge("hydra.queue.steps.copying_to", $json->{nrStepsCopyingTo}); gauge("hydra.queue.steps.copying_to", $json->{nrStepsCopyingTo});
gauge("hydra.queue.steps.copying_from", $json->{nrStepsCopyingFrom}); gauge("hydra.queue.steps.copying_from", $json->{nrStepsCopyingFrom});
gauge("hydra.queue.steps.waiting", $json->{nrStepsWaiting});
gauge("hydra.queue.steps.runnable", $json->{nrRunnableSteps}); gauge("hydra.queue.steps.runnable", $json->{nrRunnableSteps});
gauge("hydra.queue.steps.unfinished", $json->{nrUnfinishedSteps}); gauge("hydra.queue.steps.unfinished", $json->{nrUnfinishedSteps});
gauge("hydra.queue.steps.finished", $json->{nrStepsDone}); gauge("hydra.queue.steps.finished", $json->{nrStepsDone});