[Lldb-commits] [lldb] r143087 - in /lldb/trunk/test: bench-history lldbbench.py

Johnny Chen johnny.chen at apple.com
Wed Oct 26 17:32:03 PDT 2011


Author: johnny
Date: Wed Oct 26 19:32:03 2011
New Revision: 143087

URL: http://llvm.org/viewvc/llvm-project?rev=143087&view=rev
Log:
Add display of min and max samples to Stopwatch's string representation.

Modified:
    lldb/trunk/test/bench-history
    lldb/trunk/test/lldbbench.py

Modified: lldb/trunk/test/bench-history
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/bench-history?rev=143087&r1=143086&r2=143087&view=diff
==============================================================================
--- lldb/trunk/test/bench-history (original)
+++ lldb/trunk/test/bench-history Wed Oct 26 19:32:03 2011
@@ -39,3 +39,13 @@
 lldb stepping benchmark: Avg: 0.138386 (Laps: 50, Total Elapsed Time: 6.919313)
 lldb expr cmd benchmark: Avg: 0.218967 (Laps: 25, Total Elapsed Time: 5.474171)
 lldb disassembly benchmark: Avg: 0.092677 (Laps: 10, Total Elapsed Time: 0.926766)
+
+# With patch to lldbbench.py to display min and max of samples.
+[17:27:09] johnny:/Volumes/data/lldb/svn/trunk/test $ ./bench.py -e /Volumes/data/lldb/svn/regression/build/Debug/lldb -x '-F Driver::MainLoop()' 2>&1 | grep -P '^lldb.*benchmark:'
+lldb startup delay (create fresh target) benchmark: Avg: 0.103625 (Laps: 30, Total Elapsed Time: 3.108748, min=0.101225, max=0.136308)
+lldb startup delay (set first breakpoint) benchmark: Avg: 0.102321 (Laps: 30, Total Elapsed Time: 3.069623, min=0.101270, max=0.102824)
+lldb startup delay (run to breakpoint) benchmark: Avg: 0.445943 (Laps: 30, Total Elapsed Time: 13.378290, min=0.438535, max=0.475691)
+lldb frame variable benchmark: Avg: 1.612034 (Laps: 20, Total Elapsed Time: 32.240689, min=1.591328, max=1.649720)
+lldb stepping benchmark: Avg: 0.155064 (Laps: 50, Total Elapsed Time: 7.753182, min=0.101287, max=2.028978)
+lldb expr cmd benchmark: Avg: 0.206160 (Laps: 25, Total Elapsed Time: 5.154005, min=0.203282, max=0.224982)
+lldb disassembly benchmark: Avg: 0.032946 (Laps: 10, Total Elapsed Time: 0.329464, min=0.031380, max=0.039198)

Modified: lldb/trunk/test/lldbbench.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbbench.py?rev=143087&r1=143086&r2=143087&view=diff
==============================================================================
--- lldb/trunk/test/lldbbench.py (original)
+++ lldb/trunk/test/lldbbench.py Wed Oct 26 19:32:03 2011
@@ -1,4 +1,5 @@
 import time
+#import numpy
 from lldbtest import *
 
 class Stopwatch(object):
@@ -48,6 +49,7 @@
         self.__start__ = None
         self.__stop__ = None
         self.__elapsed__ = 0.0
+        self.__nums__ = []
 
     def __init__(self):
         self.reset()
@@ -66,6 +68,7 @@
             elapsed = self.__stop__ - self.__start__
             self.__total_elapsed__ += elapsed
             self.__laps__ += 1
+            self.__nums__.append(elapsed)
             self.__start__ = None # Reset __start__ to be None again.
         else:
             raise Exception("stop() called without first start()?")
@@ -78,10 +81,18 @@
         """Equal to total elapsed time divided by the number of laps."""
         return self.__total_elapsed__ / self.__laps__
 
+    #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)" % (self.avg(),
-                                                               self.__laps__,
-                                                               self.__total_elapsed__)
+        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):
     """





More information about the lldb-commits mailing list