summaryrefslogtreecommitdiffstats
path: root/lib/bb/server
diff options
context:
space:
mode:
authorRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-10 10:29:46 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2015-03-10 10:37:07 +0000
commit0e0ba408c2dce14a0fabd3fdf61d8465a031495b (patch)
tree01d542d49f25cc6b26e49cbf112fb3f6519db818 /lib/bb/server
parentfbd4a0d422cf7f43db2f9eab2e47c41246a9031e (diff)
downloadbitbake-0e0ba408c2dce14a0fabd3fdf61d8465a031495b.tar.gz
cooker/server: Fix up 100% CPU usage at idle
The recent inotify changes are causing a 100% cpu usage issue in the idle handlers. To avoid this, we update the idle functions to optionally report a float value which is the delay before the function needs to be called again. 1 second is fine for the inotify handler, in reality its more like 0.1s due to the default idle function sleep. This reverts performance regressions of 1.5 minutes on a kernel build and ~5-6 minutes on a image from scratch. Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'lib/bb/server')
-rw-r--r--lib/bb/server/process.py3
-rw-r--r--lib/bb/server/xmlrpc.py3
2 files changed, 6 insertions, 0 deletions
diff --git a/lib/bb/server/process.py b/lib/bb/server/process.py
index 7671b26a8..c9286ddba 100644
--- a/lib/bb/server/process.py
+++ b/lib/bb/server/process.py
@@ -135,6 +135,9 @@ class ProcessServer(Process, BaseImplServer):
nextsleep = None
elif retval is True:
nextsleep = None
+ elif isinstance(retval, float):
+ if (retval < nextsleep):
+ nextsleep = retval
elif nextsleep is None:
continue
else:
diff --git a/lib/bb/server/xmlrpc.py b/lib/bb/server/xmlrpc.py
index 17f3d9d90..75ec8556f 100644
--- a/lib/bb/server/xmlrpc.py
+++ b/lib/bb/server/xmlrpc.py
@@ -242,6 +242,9 @@ class XMLRPCServer(SimpleXMLRPCServer, BaseImplServer):
del self._idlefuns[function]
elif retval is True:
nextsleep = 0
+ elif isinstance(retval, float):
+ if (retval < nextsleep):
+ nextsleep = retval
else:
fds = fds + retval
except SystemExit: