summaryrefslogtreecommitdiff
path: root/HACKING.rst
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-04-12 16:29:33 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-23 22:03:27 +0900
commit1cd3728c25593a8b61669d90e56dbc9f73f5b961 (patch)
tree59a04cec98123168f4711ce144bccbd53dd7fbde /HACKING.rst
parenta18fcf0c2e5ca7b4d82dd253b2f0576e629ee767 (diff)
downloadbuildstream-1cd3728c25593a8b61669d90e56dbc9f73f5b961.tar.gz
HACKING.rst: Add a section on BST_PROFILE and the artifact cache.
Diffstat (limited to 'HACKING.rst')
-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
----------------------------