From c38f26cc8c8c65379a1b145bd99429a7cc1e68e1 Mon Sep 17 00:00:00 2001 From: Benjamin Schubert Date: Tue, 19 Mar 2019 09:24:22 +0000 Subject: Rework profiler to act as a context manager --- buildstream/_project.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'buildstream/_project.py') diff --git a/buildstream/_project.py b/buildstream/_project.py index f5da960cf..7a1734a25 100644 --- a/buildstream/_project.py +++ b/buildstream/_project.py @@ -30,7 +30,7 @@ from . import _cachekey from . import _site from . import _yaml from ._artifactelement import ArtifactElement -from ._profile import Topics, profile_start, profile_end +from ._profile import Topics, PROFILER from ._exceptions import LoadError, LoadErrorReason from ._options import OptionPool from ._artifactcache import ArtifactCache @@ -156,9 +156,8 @@ class Project(): self._fully_loaded = False self._project_includes = None - profile_start(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-')) - self._load(parent_loader=parent_loader) - profile_end(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-')) + with PROFILER.profile(Topics.LOAD_PROJECT, self.directory.replace(os.sep, '-')): + self._load(parent_loader=parent_loader) self._partially_loaded = True -- cgit v1.2.1