perf: add getlen
authortimeless <timeless@mozdev.org>
Fri, 04 Dec 2015 19:05:32 +0000
changeset 27307 f36dc0062b1a
parent 27306 bafb1235f505
child 27308 7bc52ac46172
perf: add getlen getlen will return 1 if perf.stub
contrib/perf.py
--- a/contrib/perf.py	Fri Dec 04 18:08:50 2015 +0000
+++ b/contrib/perf.py	Fri Dec 04 19:05:32 2015 +0000
@@ -12,6 +12,11 @@
 cmdtable = {}
 command = cmdutil.command(cmdtable)
 
+def getlen(ui):
+    if ui.configbool("perf", "stub"):
+        return lambda x: 1
+    return len
+
 def gettimer(ui, opts=None):
     """return a timer function and formatter: (timer, formatter)