diff options
| author | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 | 
|---|---|---|
| committer | Dimitry Andric <dim@FreeBSD.org> | 2017-01-02 19:26:05 +0000 | 
| commit | 14f1b3e8826ce43b978db93a62d1166055db5394 (patch) | |
| tree | 0a00ad8d3498783fe0193f3b656bca17c4c8697d /packages/Python/lldbsuite/test/lldbbench.py | |
| parent | 4ee8c119c71a06dcad1e0fecc8c675e480e59337 (diff) | |
Notes
Diffstat (limited to 'packages/Python/lldbsuite/test/lldbbench.py')
| -rw-r--r-- | packages/Python/lldbsuite/test/lldbbench.py | 22 | 
1 files changed, 11 insertions, 11 deletions
diff --git a/packages/Python/lldbsuite/test/lldbbench.py b/packages/Python/lldbsuite/test/lldbbench.py index 6b568f874661..26ee6c21bd9a 100644 --- a/packages/Python/lldbsuite/test/lldbbench.py +++ b/packages/Python/lldbsuite/test/lldbbench.py @@ -8,6 +8,7 @@ import time  # LLDB modules  from .lldbtest import * +  class Stopwatch(object):      """Stopwatch provides a simple utility to start/stop your stopwatch multiple      times.  Each start/stop is equal to a lap, with its elapsed time accumulated @@ -64,7 +65,8 @@ class Stopwatch(object):          if self.__start__ is None:              self.__start__ = time.time()          else: -            raise Exception("start() already called, did you forget to stop() first?") +            raise Exception( +                "start() already called, did you forget to stop() first?")          # Return self to facilitate the context manager __enter__ protocol.          return self @@ -75,7 +77,7 @@ class Stopwatch(object):              self.__total_elapsed__ += elapsed              self.__laps__ += 1              self.__nums__.append(elapsed) -            self.__start__ = None # Reset __start__ to be None again. +            self.__start__ = None  # Reset __start__ to be None again.          else:              raise Exception("stop() called without first start()?") @@ -87,32 +89,30 @@ class Stopwatch(object):          """Equal to total elapsed time divided by the number of laps."""          return self.__total_elapsed__ / self.__laps__ -    #def sigma(self): +    # def sigma(self):      #    """Return the standard deviation of the available samples."""      #    if self.__laps__ <= 0:      #        return None      #    return numpy.std(self.__nums__)      def __str__(self): -        return "Avg: %f (Laps: %d, Total Elapsed Time: %f, min=%f, max=%f)" % (self.avg(), -                                                                               self.__laps__, -                                                                               self.__total_elapsed__, -                                                                               min(self.__nums__), -                                                                               max(self.__nums__)) +        return "Avg: %f (Laps: %d, Total Elapsed Time: %f, min=%f, max=%f)" % (self.avg( +        ), self.__laps__, self.__total_elapsed__, min(self.__nums__), max(self.__nums__)) +  class BenchBase(TestBase):      """      Abstract base class for benchmark tests.      """ +      def setUp(self):          """Fixture for unittest test case setup."""          super(BenchBase, self).setUp() -        #TestBase.setUp(self) +        # TestBase.setUp(self)          self.stopwatch = Stopwatch()      def tearDown(self):          """Fixture for unittest test case teardown."""          super(BenchBase, self).tearDown() -        #TestBase.tearDown(self) +        # TestBase.tearDown(self)          del self.stopwatch -  | 
