summaryrefslogtreecommitdiff
path: root/buildstream/_artifactcache
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 /buildstream/_artifactcache
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.
Diffstat (limited to 'buildstream/_artifactcache')
-rw-r--r--buildstream/_artifactcache/pushreceive.py14
1 files changed, 14 insertions, 0 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