aboutsummaryrefslogtreecommitdiff
path: root/src/libstore/build
diff options
context:
space:
mode:
Diffstat (limited to 'src/libstore/build')
-rw-r--r--src/libstore/build/derivation-goal.cc8
-rw-r--r--src/libstore/build/local-derivation-goal.cc14
-rw-r--r--src/libstore/build/local-derivation-goal.hh2
3 files changed, 18 insertions, 6 deletions
diff --git a/src/libstore/build/derivation-goal.cc b/src/libstore/build/derivation-goal.cc
index 41d2e2a1c..9bc3dc742 100644
--- a/src/libstore/build/derivation-goal.cc
+++ b/src/libstore/build/derivation-goal.cc
@@ -869,6 +869,14 @@ void DerivationGoal::buildDone()
cleanupPostChildKill();
+ if (buildResult.cpuUser && buildResult.cpuSystem) {
+ debug("builder for '%s' terminated with status %d, user CPU %.3fs, system CPU %.3fs",
+ worker.store.printStorePath(drvPath),
+ status,
+ ((double) buildResult.cpuUser->count()) / 1000000,
+ ((double) buildResult.cpuSystem->count()) / 1000000);
+ }
+
bool diskFull = false;
try {
diff --git a/src/libstore/build/local-derivation-goal.cc b/src/libstore/build/local-derivation-goal.cc
index 2d1e093ca..f273ebe8a 100644
--- a/src/libstore/build/local-derivation-goal.cc
+++ b/src/libstore/build/local-derivation-goal.cc
@@ -137,7 +137,7 @@ void LocalDerivationGoal::killChild()
also send a conventional kill to the child. */
::kill(-pid, SIGKILL); /* ignore the result */
- killSandbox();
+ killSandbox(true);
pid.wait();
}
@@ -146,10 +146,14 @@ void LocalDerivationGoal::killChild()
}
-void LocalDerivationGoal::killSandbox()
+void LocalDerivationGoal::killSandbox(bool getStats)
{
if (cgroup) {
- destroyCgroup(*cgroup);
+ auto stats = destroyCgroup(*cgroup);
+ if (getStats) {
+ buildResult.cpuUser = stats.cpuUser;
+ buildResult.cpuSystem = stats.cpuSystem;
+ }
}
else if (buildUser) {
@@ -270,7 +274,7 @@ void LocalDerivationGoal::cleanupPostChildKill()
malicious user from leaving behind a process that keeps files
open and modifies them after they have been chown'ed to
root. */
- killSandbox();
+ killSandbox(true);
/* Terminate the recursive Nix daemon. */
stopDaemon();
@@ -410,7 +414,7 @@ void LocalDerivationGoal::startBuilder()
/* Make sure that no other processes are executing under the
sandbox uids. This must be done before any chownToBuilder()
calls. */
- killSandbox();
+ killSandbox(false);
/* Right platform? */
if (!parsedDrv->canBuildLocally(worker.store))
diff --git a/src/libstore/build/local-derivation-goal.hh b/src/libstore/build/local-derivation-goal.hh
index 1ec6b3649..34c4e9187 100644
--- a/src/libstore/build/local-derivation-goal.hh
+++ b/src/libstore/build/local-derivation-goal.hh
@@ -202,7 +202,7 @@ struct LocalDerivationGoal : public DerivationGoal
/* Kill any processes running under the build user UID or in the
cgroup of the build. */
- void killSandbox();
+ void killSandbox(bool getStats);
/* Create alternative path calculated from but distinct from the
input, so we can avoid overwriting outputs (or other store paths)