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-25 16:35:21 +0000
commitd584746223faa23eb96f48b9bde2a054b3ce016b (patch)
tree4711abf090260248db45cbb5d7f231606253612a
parenta2140d748ee4552034a0424b39c79ce6192695a8 (diff)
downloadbuildstream-d584746223faa23eb96f48b9bde2a054b3ce016b.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 7f5249575..f9d627912 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()
@@ -154,11 +155,16 @@ class Scheduler():
# Check if we need to start with some cache maintenance
self._check_cache_management()
+ # 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()