Skip to content

Commit

Permalink
Keep track of the exact build start/stop times
Browse files Browse the repository at this point in the history
  • Loading branch information
edolstra committed Dec 7, 2016
1 parent dadfddf commit b070606
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
4 changes: 4 additions & 0 deletions src/libstore/build.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1347,6 +1347,7 @@ void DerivationGoal::tryToBuild()
case rpAccept:
/* Yes, it has started doing so. Wait until we get
EOF from the hook. */
result.startTime = time(0); // inexact
state = &DerivationGoal::buildDone;
return;
case rpPostpone:
Expand Down Expand Up @@ -1424,6 +1425,7 @@ void DerivationGoal::buildDone()
debug(format("builder process for ‘%1%’ finished") % drvPath);

result.timesBuilt++;
result.stopTime = time(0);

/* So the child is gone now. */
worker.childTerminated(this);
Expand Down Expand Up @@ -2108,6 +2110,8 @@ void DerivationGoal::startBuilder()
/* Create a pipe to get the output of the builder. */
builderOut.create();

result.startTime = time(0);

/* Fork a child to build the package. */
#if __linux__
if (useChroot) {
Expand Down
4 changes: 3 additions & 1 deletion src/libstore/store-api.hh
Original file line number Diff line number Diff line change
Expand Up @@ -218,7 +218,9 @@ struct BuildResult
non-determinism.) */
bool isNonDeterministic = false;

//time_t startTime = 0, stopTime = 0;
/* The start/stop times of the build (or one of the rounds, if it
was repeated). */
time_t startTime = 0, stopTime = 0;

bool success() {
return status == Built || status == Substituted || status == AlreadyValid;
Expand Down
2 changes: 1 addition & 1 deletion src/nix-store/nix-store.cc
Original file line number Diff line number Diff line change
Expand Up @@ -961,7 +961,7 @@ static void opServe(Strings opFlags, Strings opArgs)
out << status.status << status.errorMsg;

if (GET_PROTOCOL_MINOR(clientVersion) >= 3)
out << status.timesBuilt << status.isNonDeterministic;
out << status.timesBuilt << status.isNonDeterministic << status.startTime << status.stopTime;

break;
}
Expand Down

0 comments on commit b070606

Please sign in to comment.