# HG changeset patch # User Pierre-Yves David <pierre-yves.david@octobus.net> # Date 1663033259 -7200 # Tue Sep 13 03:40:59 2022 +0200 # Node ID 1c8e5246dcdb76f16461ff3165d24eac56e6b955 # Parent dd7ba631b8e3f07544caf217f836a9acd4def480 benchmark: add new constraints about the graph Lets skip some variant if we don't have enough revision. diff --git a/docs/benchmarks.rst b/docs/benchmarks.rst --- a/docs/benchmarks.rst +++ b/docs/benchmarks.rst @@ -144,6 +144,19 @@ a shell script to run before running the perf-command. +constraints +~~~~~~~~~~~ + +Theses variables control when this benchmark can be run. + +Here is the list of currently supported constraints: + +- `graph.visible-revision-count.min=<integer>`: + + Target repository must have at least that many visible revision for this + benchmark to run. + + variants -------- diff --git a/python-libs/poulpe/benchmarks.py b/python-libs/poulpe/benchmarks.py --- a/python-libs/poulpe/benchmarks.py +++ b/python-libs/poulpe/benchmarks.py @@ -13,6 +13,24 @@ class UnknownBenchmarkMethod(KeyError): pass +def _merge_constraint(core, new): + # XXX implement something proper sometime + t = core.get('graph', {}) + t = t.get('visible-revision-count', {}) + core_revs = t.get('min', None) + + t = new.get('graph', {}) + t = t.get('visible-revision-count', {}) + new_revs = t.get('min', None) + if new_revs is None: + pass # nothing to do + elif core_revs is None: + t = core.setdefault('graph', {}) + t = t.setdefault('visible-revision-count', {}) + t['min'] = new_revs + else: + core['graph']['visible-revision-count'] = min(new_revs, core_revs) + def get_benchmark(path_def): """get a benchmark from path applying possible variant selection on the way @@ -83,6 +101,19 @@ return {} @property + def constraints(self): + c = {} + c['needed-vars'] = self.needed_vars + # XXX need to fetch graph constraint for the core variable too + min_rev = None + + for dimension, variants in self.all_dimensions.items(): + selected = self._selected_variants[dimension] + values = variants[selected] + _merge_constraint(c, values.get('constraints', {})) + return c + + @property def needed_vars(self): return set() diff --git a/suites/hg/benchmarks/perf-bundle.pbd b/suites/hg/benchmarks/perf-bundle.pbd --- a/suites/hg/benchmarks/perf-bundle.pbd +++ b/suites/hg/benchmarks/perf-bundle.pbd @@ -15,17 +15,35 @@ default=true args=["--rev", "last(all(), 40000)"] +[hg-perf-ext.variants.dimensions.revs.last-40000.constraints.graph] +visible-revision-count.min=40000 + [hg-perf-ext.variants.dimensions.revs.last-10000] args=["--rev", "last(all(), 10000)"] +[hg-perf-ext.variants.dimensions.revs.last-10000.constraints.graph] +visible-revision-count.min=10000 + [hg-perf-ext.variants.dimensions.revs.last-1000] args=["--rev", "last(all(), 1000)"] +[hg-perf-ext.variants.dimensions.revs.last-1000.constraints.graph] +visible-revision-count.min=1000 + [hg-perf-ext.variants.dimensions.revs.last-100] args=["--rev", "last(all(), 100)"] +[hg-perf-ext.variants.dimensions.revs.last-100.constraints.graph] +visible-revision-count.min=100 + [hg-perf-ext.variants.dimensions.revs.last-10] args=["--rev", "last(all(), 10)"] +[hg-perf-ext.variants.dimensions.revs.last-10.constraints.graph] +visible-revision-count.min=10 + [hg-perf-ext.variants.dimensions.revs.last-1] args=["--rev", "last(all(), 1)"] + +[hg-perf-ext.variants.dimensions.revs.last-1.constraints.graph] +visible-revision-count.min=1 diff --git a/suites/hg/benchmarks/perf-unbundle.pbd b/suites/hg/benchmarks/perf-unbundle.pbd --- a/suites/hg/benchmarks/perf-unbundle.pbd +++ b/suites/hg/benchmarks/perf-unbundle.pbd @@ -14,18 +14,32 @@ [hg-perf-ext.variants.dimensions.revs.last-35000] default=true setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 35000)' --base 'not last(all(), 35000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 35000)'; hg debugupdatecache" +[hg-perf-ext.variants.dimensions.revs.last-35000.constraints.graph] +visible-revision-count.min=35000 + [hg-perf-ext.variants.dimensions.revs.last-10000] setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 10000)' --base 'not last(all(), 10000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 10000)'; hg debugupdatecache" +[hg-perf-ext.variants.dimensions.revs.last-10000.constraints.graph] +visible-revision-count.min=10000 + [hg-perf-ext.variants.dimensions.revs.last-1000] setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 1000)' --base 'not last(all(), 1000)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 1000)'; hg debugupdatecache" +[hg-perf-ext.variants.dimensions.revs.last-1000.constraints.graph] +visible-revision-count.min=1000 [hg-perf-ext.variants.dimensions.revs.last-100] setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 100)' --base 'not last(all(), 100)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 100)'; hg debugupdatecache" +[hg-perf-ext.variants.dimensions.revs.last-100.constraints.graph] +visible-revision-count.min=100 [hg-perf-ext.variants.dimensions.revs.last-10] setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 10)' --base 'not last(all(), 10)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 10)'; hg debugupdatecache" +[hg-perf-ext.variants.dimensions.revs.last-10.constraints.graph] +visible-revision-count.min=10 [hg-perf-ext.variants.dimensions.revs.last-1] setup-script = "hg bundle --type none-v2 ../tmp-bundle.hg --rev 'last(all(), 1)' --base 'not last(all(), 1)' ; hg --config extensions.strip= strip --no-backup 'last(all(), 1)'; hg debugupdatecache" +[hg-perf-ext.variants.dimensions.revs.last-1.constraints.graph] +visible-revision-count.min=1 diff --git a/suites/hg/scheduling/auto-cases b/suites/hg/scheduling/auto-cases --- a/suites/hg/scheduling/auto-cases +++ b/suites/hg/scheduling/auto-cases @@ -129,11 +129,25 @@ def benchmark_compatible_with(base_dir, data_env, changeset, benchmark): - for v in benchmark.needed_vars: + constraints = benchmark.constraints + for v in constraints['needed-vars']: try: data_env.get_benchmark_input_vars(v) except errors.MissingDataEnvInputVars: return False + t = constraints.get('graph', {}) + t = t.get('visible-revision-count', {}) + min_revs = t.get('min', None) + if min_revs is not None: + data_var = data_env.data_env_vars + t = data_var.get('mercurial', {}) + t = t.get('repo', {}) + t = t.get('graph', {}) + revs = t.get('visible-revision-count') + if revs is None: + return False # we can't know + if min_revs > revs: + return False return True