# HG changeset patch
# User Pierre-Yves David <pierre-yves.david@octobus.net>
# Date 1542944822 -3600
#      Fri Nov 23 04:47:02 2018 +0100
# Node ID edb2894496ab34d4c9a40071e9f797e32e32a5fb
# Parent  4fafef4c9eae619f8e4bbc92567118ca8d430b13
benchmark: also track time from perfbranchmapupdate

This command is benchmarking some in-progress work.

diff --git a/benchmarks/others.py b/benchmarks/others.py
--- a/benchmarks/others.py
+++ b/benchmarks/others.py
@@ -401,3 +401,32 @@
         if None not in data:
             return float('nan')
         return data[None]['median']
+
+class PerfBranchmapUpdateSuite(BaseTestSuite):
+    params = BaseTestSuite.params + [['cold', 'warm'], [1, 100, 10000]]
+    param_names = BaseTestSuite.param_names + ['caches', 'missingrevs']
+
+    timeout = 300
+
+    @params_as_kwargs
+    def track_perfbranchmap_update(self, caches, missingrevs, *args, **kwargs):
+        if caches == 'warm':
+            clearcache = False
+        elif caches == 'cold':
+            clearcache = True
+        else:
+            assert False
+
+        cmd = ['perfbranchmapupdate', '--quiet']
+        if clearcache:
+            cmd.append('--clear-caches')
+        else:
+            cmd.append('--no-clear-caches')
+        cmd.append('--base')
+        cmd.append('not -%d:' % missingrevs)
+        cmd.append('--target')
+        cmd.append('-%d:' % missingrevs)
+        data = self.perfextjson(*cmd)
+        if None not in data:
+            return float('nan')
+        return data[None]['median']