aboutsummaryrefslogtreecommitdiff
path: root/libbuild2/context.cxx
diff options
context:
space:
mode:
authorBoris Kolpackov <boris@codesynthesis.com>2022-04-08 08:10:32 +0200
committerBoris Kolpackov <boris@codesynthesis.com>2022-04-08 08:10:32 +0200
commit230e7cb0bab4582132de2bc411e355eacbacff4a (patch)
tree166ca16718762b679777b6fb198dc053187d3c89 /libbuild2/context.cxx
parentd8cba1bae2b0212c7f8bc5af5c33709a6e622510 (diff)
Add phase switch contention to build statistics
Diffstat (limited to 'libbuild2/context.cxx')
-rw-r--r--libbuild2/context.cxx8
1 files changed, 8 insertions, 0 deletions
diff --git a/libbuild2/context.cxx b/libbuild2/context.cxx
index 80343bd..d460fa7 100644
--- a/libbuild2/context.cxx
+++ b/libbuild2/context.cxx
@@ -765,6 +765,8 @@ namespace build2
}
else if (ctx_.phase != n)
{
+ ++contention;
+
ctx_.sched.deactivate (false /* external */);
for (; ctx_.phase != n; v->wait (l)) ;
r = !fail_;
@@ -781,6 +783,8 @@ namespace build2
{
if (!lm_.try_lock ())
{
+ ++contention;
+
ctx_.sched.deactivate (false /* external */);
lm_.lock ();
ctx_.sched.activate (false /* external */);
@@ -901,6 +905,8 @@ namespace build2
}
else // phase != n
{
+ ++contention;
+
ctx_.sched.deactivate (false /* external */);
for (; ctx_.phase != n; v->wait (l)) ;
r = !fail_;
@@ -913,6 +919,8 @@ namespace build2
{
if (!lm_.try_lock ())
{
+ ++contention;
+
ctx_.sched.deactivate (false /* external */);
lm_.lock ();
ctx_.sched.activate (false /* external */);