This is an automated email from the ASF dual-hosted git repository. tvb pushed a commit to branch tristan/partial-variables-manual-string-join in repository https://gitbox.apache.org/repos/asf/buildstream.git
commit 4a148bc3ccdfe509e64240e1b59d186bd6764c13 Author: Tristan van Berkom <[email protected]> AuthorDate: Tue Jul 7 22:32:46 2020 +0900 _variables: ENABLE PROFILING --- src/buildstream/_profile.py | 2 ++ src/buildstream/_variables.pyx | 21 ++++++++++++++------- 2 files changed, 16 insertions(+), 7 deletions(-) diff --git a/src/buildstream/_profile.py b/src/buildstream/_profile.py index 0219e83..bc3958e 100644 --- a/src/buildstream/_profile.py +++ b/src/buildstream/_profile.py @@ -48,6 +48,8 @@ class Topics: LOAD_PIPELINE = "load-pipeline" LOAD_SELECTION = "load-selection" SCHEDULER = "scheduler" + VARIABLES_INIT = "variables-init" + VARIABLES_CHECK = "variables-check" ALL = "all" diff --git a/src/buildstream/_variables.pyx b/src/buildstream/_variables.pyx index c1c368a..c1d7b92 100644 --- a/src/buildstream/_variables.pyx +++ b/src/buildstream/_variables.pyx @@ -28,6 +28,7 @@ from cpython.mem cimport PyMem_Malloc, PyMem_Free, PyMem_Realloc from cpython.object cimport PyObject from cpython.ref cimport Py_XINCREF, Py_XDECREF +from ._profile import Topics, PROFILER from ._exceptions import LoadError from .exceptions import LoadErrorReason from .node cimport MappingNode, Node, ScalarNode, SequenceNode, ProvenanceInformation @@ -57,9 +58,12 @@ ctypedef struct ObjectArray: cdef class Variables: cdef dict _values # The Value objects + cdef MappingNode _origin def __init__(self, MappingNode node): + self._origin = node + # Special case, if notparallel is specified in the variables for this # element, then override max-jobs to be 1. # Initialize it as a string as all variables are processed as strings. @@ -173,9 +177,10 @@ cdef class Variables: cpdef check(self): cdef object key - # Resolve all variables. - for key in self._values.keys(): - self._resolve(<str> key, None) + with PROFILER.profile(Topics.VARIABLES_CHECK, id(self._origin)): + # Resolve all variables. + for key in self._values.keys(): + self._resolve(<str> key, None) # _init_values() # @@ -188,10 +193,12 @@ cdef class Variables: cdef object value_node cdef Value value - for key, value_node in node.items(): - value = Value() - value.init(<ScalarNode> value_node) - ret[key] = value + with PROFILER.profile(Topics.VARIABLES_INIT, id(self._origin)): + + for key, value_node in node.items(): + value = Value() + value.init(<ScalarNode> value_node) + ret[key] = value return ret
