summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJames Ennis <james.ennis@codethink.com>2019-01-18 17:16:49 +0000
committerJames Ennis <james.ennis@codethink.com>2019-01-21 10:17:15 +0000
commitc75953f7459b51ba336fd1de7a5aea8578a98a25 (patch)
tree4a83f140cc8b02dcefb8a762964a06d91a0f4750
parentad2df651bc3fd0d3bfe915ed81a0b5df6a0e2ca2 (diff)
downloadbuildstream-c75953f7459b51ba336fd1de7a5aea8578a98a25.tar.gz
_profile.py: Added a new profiling topic, scheduler
profile_start() and profile_end() calls have been incorporated into Scheduler.run()
-rw-r--r--buildstream/_profile.py1
-rw-r--r--buildstream/_scheduler/scheduler.py6
2 files changed, 7 insertions, 0 deletions
diff --git a/buildstream/_profile.py b/buildstream/_profile.py
index 6d8da9f66..b293c342b 100644
--- a/buildstream/_profile.py
+++ b/buildstream/_profile.py
@@ -46,6 +46,7 @@ class Topics():
LOAD_CONTEXT = 'load-context'
LOAD_PROJECT = 'load-project'
LOAD_PIPELINE = 'load-pipeline'
+ SCHEDULER = 'scheduler'
SHOW = 'show'
ARTIFACT_RECEIVE = 'artifact-receive'
ALL = 'all'
diff --git a/buildstream/_scheduler/scheduler.py b/buildstream/_scheduler/scheduler.py
index 9b688d1dd..ea9b77213 100644
--- a/buildstream/_scheduler/scheduler.py
+++ b/buildstream/_scheduler/scheduler.py
@@ -29,6 +29,7 @@ from contextlib import contextmanager
# Local imports
from .resources import Resources, ResourceType
from .jobs import JobStatus, CacheSizeJob, CleanupJob
+from .._profile import Topics, profile_start, profile_end
# A decent return code for Scheduler.run()
@@ -151,11 +152,16 @@ class Scheduler():
# Handle unix signals while running
self._connect_signals()
+ # Start the profiler
+ profile_start(Topics.SCHEDULER, "_".join(queue.action_name for queue in self.queues))
+
# Run the queues
self._sched()
self.loop.run_forever()
self.loop.close()
+ profile_end(Topics.SCHEDULER, "_".join(queue.action_name for queue in self.queues))
+
# Stop handling unix signals
self._disconnect_signals()