You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@buildstream.apache.org by tv...@apache.org on 2021/02/04 07:19:06 UTC

[buildstream] 07/21: TEMP: time and size of pickling and spawning

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

tvb pushed a commit to branch aevri/win32
in repository https://gitbox.apache.org/repos/asf/buildstream.git

commit a232a8fa7288a33016afef9b08c2f933cf99958a
Author: Angelos Evripiotis <je...@bloomberg.net>
AuthorDate: Wed Apr 10 12:59:21 2019 +0100

    TEMP: time and size of pickling and spawning
---
 src/buildstream/_scheduler/jobs/job.py | 22 ++++++++++++++++++++--
 1 file changed, 20 insertions(+), 2 deletions(-)

diff --git a/src/buildstream/_scheduler/jobs/job.py b/src/buildstream/_scheduler/jobs/job.py
index e844c80..440a85b 100644
--- a/src/buildstream/_scheduler/jobs/job.py
+++ b/src/buildstream/_scheduler/jobs/job.py
@@ -261,12 +261,30 @@ class Job():
 
         self._process = Process(target=child_job.child_action, args=[self._queue])
 
+        import contextlib
+        import time
+        @contextlib.contextmanager
+        def timer(message):
+            then = time.time()
+            yield
+            now = time.time()
+            print(f"({now - then:,.2}s):", message)
+
+        import buildstream.testpickle
+        with timer(f"Pickle {self._child_action}"):
+            pickled_process = buildstream.testpickle.test_pickle_direct(self._child_action)
+        print(f"Size of pickled data: {len(pickled_process.getbuffer()):,}")
+        import pickle
+        pickled_process.seek(0)
+        # unpickled_process = pickle.load(pickled_process)
+
         # Block signals which are handled in the main process such that
         # the child process does not inherit the parent's state, but the main
         # process will be notified of any signal after we launch the child.
         #
-        with _signals.blocked([signal.SIGINT, signal.SIGTSTP, signal.SIGTERM], ignore=False):
-            self._process.start()
+        with timer(f"process.start {self}"):
+            with _signals.blocked([signal.SIGINT, signal.SIGTSTP, signal.SIGTERM], ignore=False):
+                self._process.start()
 
         # Wait for the child task to complete.
         #