Patchwork [5,of,8] contrib/perf: add getlen

login
register
mail settings
Submitter timeless@mozdev.org
Date Dec. 8, 2015, 7:07 a.m.
Message ID <8e92b61c81221b2dbfd3.1449558446@waste.org>
Download mbox | patch
Permalink /patch/11928/
State Accepted
Headers show

Comments

timeless@mozdev.org - Dec. 8, 2015, 7:07 a.m.
# HG changeset patch
# User timeless <timeless@mozdev.org>
# Date 1449255932 0
#      Fri Dec 04 19:05:32 2015 +0000
# Node ID 8e92b61c81221b2dbfd351745e8c60e8ffca38f3
# Parent  80b1b6ccc3d7931ac3b4af2ad6d029a461e41bbe
contrib/perf: add getlen

get len will return 1 if perf.stub

Patch

diff --git a/contrib/perf.py b/contrib/perf.py
--- a/contrib/perf.py
+++ b/contrib/perf.py
@@ -11,6 +11,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)