summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-04-12 16:29:33 +0100
committerJim MacArthur <jim.macarthur@codethink.co.uk>2018-04-23 11:45:02 +0100
commit75620cd7bc7e87a83ce5783a21a91f02ec0d32ab (patch)
tree349810e25cb68f820bba69b47c7980af76103afc
parent26e5d012e7e3fa2b58a29218da886e0a5a0f7389 (diff)
downloadbuildstream-jmac/artifact-receive-profiling.tar.gz
HACKING.rst: Add a section on BST_PROFILE and the artifact cache.jmac/artifact-receive-profiling
-rw-r--r--HACKING.rst33
1 files changed, 33 insertions, 0 deletions
diff --git a/HACKING.rst b/HACKING.rst
index 17ca7a281..844e7861f 100644
--- a/HACKING.rst
+++ b/HACKING.rst
@@ -445,6 +445,39 @@ to generate an .svg image:
The generated SVG file can then be viewed in your preferred web browser.
+Profiling specific parts of BuildStream with BST_PROFILE
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+BuildStream can also turn on cProfile for specific parts of execution
+using BST_PROFILE.
+
+BST_PROFILE can be set to a section name, or 'all' for all
+sections. There is a list of topics in `buildstream/_profile.py`. For
+example, running::
+
+ BST_PROFILE=load-pipeline bst build bootstrap-system-x86.bst
+
+will produce a profile in the current directory for the time take to
+call most of `initialized`, for each element. These profile files
+are in the same cProfile format as those mentioned in the previous
+section, and can be analysed with `pstats` or `pyflame`.
+
+Profiling the artifact cache receiver
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+Since the artifact cache receiver is not normally run directly, it's
+necessary to alter the ForceCommand part of sshd_config to enable
+profiling. See the main documentation in `doc/source/artifacts.rst`
+for general information on setting up the artifact cache. It's also
+useful to change directory to a logging directory before starting
+`bst-artifact-receive` with profiling on.
+
+This is an example of a ForceCommand section of sshd_config used to
+obtain profiles::
+
+ Match user artifacts
+ ForceCommand BST_PROFILE=artifact-receive cd /tmp && bst-artifact-receive --pull-url https://example.com/ /home/artifacts/artifacts
+
The MANIFEST.in and setup.py
----------------------------