summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim MacArthur <jim.macarthur@codethink.co.uk>2018-04-12 12:31:49 +0100
committerTristan Van Berkom <tristan.vanberkom@codethink.co.uk>2018-04-23 22:03:27 +0900
commita18fcf0c2e5ca7b4d82dd253b2f0576e629ee767 (patch)
treeb80d9a6d2dc3398c3dbb86609c9f56238b94e486
parent2fe1010a72093dc284a3936c91521a18395ee450 (diff)
downloadbuildstream-a18fcf0c2e5ca7b4d82dd253b2f0576e629ee767.tar.gz
Add artifact cache receive profiling domain
_artifactcache/pushreceive.py: Wrap OSTreeReceiver.do_run in a profiling domain. _profile.py: Add 'ARTIFACT_RECEIVE' domain.
-rw-r--r--buildstream/_artifactcache/pushreceive.py14
-rw-r--r--buildstream/_profile.py3
2 files changed, 16 insertions, 1 deletions
diff --git a/buildstream/_artifactcache/pushreceive.py b/buildstream/_artifactcache/pushreceive.py
index d2eaf2dc0..a1282d32d 100644
--- a/buildstream/_artifactcache/pushreceive.py
+++ b/buildstream/_artifactcache/pushreceive.py
@@ -21,6 +21,7 @@
import logging
import multiprocessing
import os
+import re
import subprocess
import sys
import shutil
@@ -33,6 +34,7 @@ import click
import gi
from .. import _signals # nopep8
+from .._profile import Topics, profile_start, profile_end
gi.require_version('OSTree', '1.0')
# pylint: disable=wrong-import-position,wrong-import-order
@@ -619,6 +621,16 @@ class OSTreeReceiver(object):
return 0
update_refs = args
+ profile_names = set()
+ for update_ref in update_refs:
+ # Strip off the SHA256 sum on the right of the reference,
+ # leaving the project and element name
+ project_and_element_name = re.sub(r"/[a-z0-9]+$", '', update_ref)
+ profile_names.add(project_and_element_name)
+
+ profile_name = '_'.join(profile_names)
+ profile_start(Topics.ARTIFACT_RECEIVE, profile_name)
+
self.writer.send_status(True)
# Wait for putobjects or done
@@ -661,6 +673,8 @@ class OSTreeReceiver(object):
# Inform pusher that everything is in place
self.writer.send_done()
+ profile_end(Topics.ARTIFACT_RECEIVE, profile_name)
+
return 0
diff --git a/buildstream/_profile.py b/buildstream/_profile.py
index 0bf4a3dcd..4d39cfc5e 100644
--- a/buildstream/_profile.py
+++ b/buildstream/_profile.py
@@ -39,7 +39,7 @@ initialized = False
#
# BST_PROFILE=circ-dep-check:sort-deps bst <command> <args>
#
-# The special 'all' value will enable all profiles
+# The special 'all' value will enable all profiles.
class Topics():
CIRCULAR_CHECK = 'circ-dep-check'
SORT_DEPENDENCIES = 'sort-deps'
@@ -48,6 +48,7 @@ class Topics():
LOAD_PROJECT = 'load-project'
LOAD_PIPELINE = 'load-pipeline'
SHOW = 'show'
+ ARTIFACT_RECEIVE = 'artifact-receive'
ALL = 'all'