diff options
author | James Ennis <james.ennis@codethink.com> | 2019-01-18 17:16:49 +0000 |
---|---|---|
committer | James Ennis <james.ennis@codethink.com> | 2019-01-18 17:16:49 +0000 |
commit | 1a08ddbff0783c5f655c166d56a62a978e54a500 (patch) | |
tree | b9aacc3cf95357674183a60ead35f2b337e5099e | |
parent | ad2df651bc3fd0d3bfe915ed81a0b5df6a0e2ca2 (diff) | |
download | buildstream-1a08ddbff0783c5f655c166d56a62a978e54a500.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.py | 1 | ||||
-rw-r--r-- | buildstream/_scheduler/scheduler.py | 7 |
2 files changed, 7 insertions, 1 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..2d026c0df 100644 --- a/buildstream/_scheduler/scheduler.py +++ b/buildstream/_scheduler/scheduler.py @@ -29,7 +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() class SchedStatus(): @@ -151,11 +151,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() |