From 1cd3728c25593a8b61669d90e56dbc9f73f5b961 Mon Sep 17 00:00:00 2001 From: Jim MacArthur Date: Thu, 12 Apr 2018 16:29:33 +0100 Subject: HACKING.rst: Add a section on BST_PROFILE and the artifact cache. --- HACKING.rst | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) 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 ---------------------------- -- cgit v1.2.1