You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by ro...@apache.org on 2020/12/29 13:40:55 UTC

[buildstream] 01/02: _profile.py: Added a new profiling topic, scheduler

This is an automated email from the ASF dual-hosted git repository.

root pushed a commit to branch jennis/profiling_topics
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit c75953f7459b51ba336fd1de7a5aea8578a98a25
Author: James Ennis <ja...@codethink.com>
AuthorDate: Fri Jan 18 17:16:49 2019 +0000

    _profile.py: Added a new profiling topic, scheduler
    
    profile_start() and profile_end() calls have been incorporated into
    Scheduler.run()
---
 buildstream/_profile.py             | 1 +
 buildstream/_scheduler/scheduler.py | 6 ++++++
 2 files changed, 7 insertions(+)

diff --git a/buildstream/_profile.py b/buildstream/_profile.py
index 6d8da9f..b293c34 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 9b688d1..ea9b772 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()