1- From 11634e6f497f7fb9a3509c549832f94b5cb86865 Mon Sep 17 00:00:00 2001
1+ From 9edd0115fec81c1add7e1301eaccb0a3eef49d2e Mon Sep 17 00:00:00 2001
22From: Mohaned Qunaibit <mohaned.qunaibit@oracle.com>
3- Date: Fri, 1 Dec 2023 05:32:57 +0300
4- Subject: [PATCH] Add asv features
3+ Date: Tue, 5 Dec 2023 14:47:39 +0300
4+ Subject: [PATCH] patch 0.5.1
55
66---
77 LICENSE.rst | 1 +
88 README.rst | 51 +++++
9- asv/benchmark.py | 40 +++-
9+ asv/benchmark.py | 38 +++-
1010 asv/commands/common_args.py | 19 ++
1111 asv/commands/publish.py | 11 ++
1212 asv/commands/run.py | 2 +-
@@ -19,7 +19,7 @@ Subject: [PATCH] Add asv features
1919 asv/www/comparisonlist.js | 362 ++++++++++++++++++++++++++++++++++
2020 asv/www/index.html | 9 +
2121 docs/source/benchmarks.rst | 3 +
22- 15 files changed, 899 insertions(+), 27 deletions(-)
22+ 15 files changed, 898 insertions(+), 26 deletions(-)
2323 create mode 100644 asv/plugins/comparisonlist.py
2424 create mode 100644 asv/www/comparisonlist.css
2525 create mode 100644 asv/www/comparisonlist.js
@@ -97,10 +97,10 @@ index e916d68..62fca24 100644
9797 <http://opensource.org/licenses/BSD-3-Clause>`__.
9898
9999diff --git a/asv/benchmark.py b/asv/benchmark.py
100- index d92b4a7..721d272 100644
100+ index 3f5a9e7..55c93ff 100644
101101--- a/asv/benchmark.py
102102+++ b/asv/benchmark.py
103- @@ -359 ,6 +359 ,8 @@ class Benchmark:
103+ @@ -462 ,6 +462 ,8 @@ class Benchmark(object) :
104104 self._params = _get_first_attr(attr_sources, "params", [])
105105 self.param_names = _get_first_attr(attr_sources, "param_names", [])
106106 self._current_params = ()
@@ -109,14 +109,14 @@ index d92b4a7..721d272 100644
109109
110110 # Enforce params format
111111 try:
112- @@ -445 ,12 +447,23 @@ class Benchmark:
112+ @@ -548 ,12 +550,22 @@ class Benchmark(object) :
113113 try:
114114 for setup in self._setups:
115115 setup(*self._current_params)
116116+ self.warmup_process()
117117 except NotImplementedError as e:
118118 # allow skipping test
119- print(f "asv: skipped: {e !r} ")
119+ print("asv: skipped: {!r} ".format(e) )
120120 return True
121121 return False
122122
@@ -128,12 +128,11 @@ index d92b4a7..721d272 100644
128128+ self.warmup_func()
129129+ warmup_count -= 1
130130+ self.warmup_func = None
131- +
132131+
133132 def redo_setup(self):
134133 if not self._redo_setup_next:
135134 self._redo_setup_next = True
136- @@ -512 ,6 +525 ,8 @@ class TimeBenchmark(Benchmark):
135+ @@ -615 ,6 +627 ,8 @@ class TimeBenchmark(Benchmark):
137136 self.sample_time = _get_first_attr(self._attr_sources, 'sample_time', 0.01)
138137 self.warmup_time = _get_first_attr(self._attr_sources, 'warmup_time', -1)
139138 self.timer = _get_first_attr(self._attr_sources, 'timer', wall_timer)
@@ -142,7 +141,7 @@ index d92b4a7..721d272 100644
142141
143142 def do_setup(self):
144143 result = Benchmark.do_setup(self)
145- @@ -526 ,6 +541 ,8 @@ class TimeBenchmark(Benchmark):
144+ @@ -628 ,6 +642 ,8 @@ class TimeBenchmark(Benchmark):
146145 else:
147146 func = self.func
148147
@@ -151,7 +150,7 @@ index d92b4a7..721d272 100644
151150 timer = timeit.Timer(
152151 stmt=func,
153152 setup=self.redo_setup,
154- @@ -534 ,10 +551 ,19 @@ class TimeBenchmark(Benchmark):
153+ @@ -636 ,10 +652 ,19 @@ class TimeBenchmark(Benchmark):
155154 return timer
156155
157156 def run(self, *param):
@@ -171,16 +170,15 @@ index d92b4a7..721d272 100644
171170 else:
172171 # Transient effects exist also on CPython, e.g. from
173172 # OS scheduling
174- @@ -569,14 +595,24 @@ class TimeBenchmark(Benchmark):
175- warmup_time=warmup_time,
173+ @@ -672,13 +697,24 @@ class TimeBenchmark(Benchmark):
176174 number=self.number,
177175 min_run_count=self.min_run_count)
176+
178177+ if self.do_maxrss == 2:
179178+ maxrss = get_maxrss()
180-
181- - samples = [s / number for s in samples]
179+ +
180+ samples = [s/ number for s in samples]
182181- return {'samples': samples, 'number': number}
183- + samples = [s/number for s in samples]
184182+ return {'samples': samples, 'number': number, 'maxrss' : maxrss}
185183
186184 def benchmark_timing(self, timer, min_repeat, max_repeat, max_time, warmup_time,
@@ -199,10 +197,10 @@ index d92b4a7..721d272 100644
199197 run_count = 0
200198
201199diff --git a/asv/commands/common_args.py b/asv/commands/common_args.py
202- index 05fcf15..749a40e 100644
200+ index 76cc729..9625a85 100644
203201--- a/asv/commands/common_args.py
204202+++ b/asv/commands/common_args.py
205- @@ -157 ,10 +157 ,19 @@ def add_bench(parser):
203+ @@ -159 ,10 +159 ,19 @@ def add_bench(parser):
206204
207205 return affinity_list
208206
@@ -222,7 +220,7 @@ index 05fcf15..749a40e 100644
222220 'repeat': parse_repeat,
223221 'number': int,
224222 'rounds': int,
225- @@ -181 ,6 +190 ,16 @@ def add_bench(parser):
223+ @@ -183 ,6 +192 ,16 @@ def add_bench(parser):
226224 help=("Set CPU affinity for running the benchmark, in format: "
227225 "0 or 0,1,2 or 0-3. Default: not set"))
228226
@@ -240,10 +238,10 @@ index 05fcf15..749a40e 100644
240238 def add_machine(parser):
241239 parser.add_argument(
242240diff --git a/asv/commands/publish.py b/asv/commands/publish.py
243- index 9e84b0c..a16d20f 100644
241+ index 43204e9..176e558 100644
244242--- a/asv/commands/publish.py
245243+++ b/asv/commands/publish.py
246- @@ -58 ,6 +58 ,14 @@ class Publish(Command):
244+ @@ -68 ,6 +68 ,14 @@ class Publish(Command):
247245 '--html-dir', '-o', default=None, help=(
248246 "Optional output directory. Default is 'html_dir' "
249247 "from asv config"))
@@ -258,7 +256,7 @@ index 9e84b0c..a16d20f 100644
258256
259257 parser.set_defaults(func=cls.run_from_args)
260258
261- @@ -67 ,6 +75 ,9 @@ class Publish(Command):
259+ @@ -77 ,6 +85 ,9 @@ class Publish(Command):
262260 def run_from_conf_args(cls, conf, args):
263261 if args.html_dir is not None:
264262 conf.html_dir = args.html_dir
@@ -269,10 +267,10 @@ index 9e84b0c..a16d20f 100644
269267
270268 @staticmethod
271269diff --git a/asv/commands/run.py b/asv/commands/run.py
272- index 457c127..b88028d 100644
270+ index 9e19b6c..ed38412 100644
273271--- a/asv/commands/run.py
274272+++ b/asv/commands/run.py
275- @@ -495 ,7 +495 ,7 @@ class Run(Command):
273+ @@ -514 ,7 +514 ,7 @@ class Run(Command):
276274 record_samples=(record_samples or force_record_samples),
277275 append_samples=(append_samples or force_append_samples),
278276 run_rounds=run_rounds,
@@ -282,10 +280,10 @@ index 457c127..b88028d 100644
282280 skip_benchmarks(benchmark_set, env, results=result)
283281
284282diff --git a/asv/config.py b/asv/config.py
285- index 473007c..5137b55 100644
283+ index c6d15d7..b52c846 100644
286284--- a/asv/config.py
287285+++ b/asv/config.py
288- @@ -42 ,6 +42 ,8 @@ class Config:
286+ @@ -46 ,6 +46 ,8 @@ class Config(object) :
289287 self.build_command = None
290288 self.install_command = None
291289 self.uninstall_command = None
@@ -537,10 +535,10 @@ index 0000000..dfe078f
537535+ fp.write(row)
538536+ fp.write('\n\n\n')
539537diff --git a/asv/runner.py b/asv/runner.py
540- index b5c6a7b..364ee95 100644
538+ index 2c19e15..9321f33 100644
541539--- a/asv/runner.py
542540+++ b/asv/runner.py
543- @@ -103 ,7 +103 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
541+ @@ -111 ,7 +111 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
544542 extra_params=None,
545543 record_samples=False, append_samples=False,
546544 run_rounds=None,
@@ -550,7 +548,7 @@ index b5c6a7b..364ee95 100644
550548 """
551549 Run all of the benchmarks in the given `Environment`.
552550
553- @@ -156 ,6 +157 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
551+ @@ -164 ,6 +165 ,8 @@ def run_benchmarks(benchmarks, env, results=None,
554552 extra_params['repeat'] = 1
555553 extra_params['warmup_time'] = 0
556554 extra_params['rounds'] = 1
@@ -559,7 +557,7 @@ index b5c6a7b..364ee95 100644
559557
560558 if results is None:
561559 results = Results.unnamed()
562- @@ -351 ,16 +354 ,29 @@ def run_benchmarks(benchmarks, env, results=None,
560+ @@ -359 ,16 +362 ,29 @@ def run_benchmarks(benchmarks, env, results=None,
563561 benchmark_durations[name] = (ended_at - started_at).total_seconds()
564562
565563 # Save result
@@ -591,7 +589,7 @@ index b5c6a7b..364ee95 100644
591589 failed_benchmarks.add(name)
592590
593591 # Log result
594- @@ -500 ,8 +516 ,11 @@ def run_benchmark(benchmark, spawner, profile,
592+ @@ -508 ,8 +524 ,11 @@ def run_benchmark(benchmark, spawner, profile,
595593 samples = []
596594 number = []
597595 profiles = []
@@ -603,16 +601,16 @@ index b5c6a7b..364ee95 100644
603601
604602 if benchmark['params']:
605603 param_iter = enumerate(itertools.product(*benchmark['params']))
606- @@ -514 ,6 +533 ,8 @@ def run_benchmark(benchmark, spawner, profile,
604+ @@ -522 ,6 +541 ,8 @@ def run_benchmark(benchmark, spawner, profile,
607605 samples.append(None)
608606 number.append(None)
609607 profiles.append(None)
610- + result_maxrss.append(math .nan)
608+ + result_maxrss.append(util .nan)
611609+ ignored_maxrss.append(None)
612610 continue
613611
614612 if isinstance(extra_params, list):
615- @@ -525 ,28 +546 ,44 @@ def run_benchmark(benchmark, spawner, profile,
613+ @@ -533 ,28 +554 ,44 @@ def run_benchmark(benchmark, spawner, profile,
616614 benchmark, spawner, param_idx,
617615 extra_params=cur_extra_params, profile=profile,
618616 cwd=cwd)
@@ -668,16 +666,16 @@ index b5c6a7b..364ee95 100644
668666
669667
670668 def _run_benchmark_single_param(benchmark, spawner, param_idx,
671- @@ -611 ,6 +648 ,7 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
669+ @@ -619 ,6 +656 ,7 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
672670 result = None
673671 samples = None
674672 number = None
675673+ maxrss = None
676674 else:
677675 with open(result_file.name, 'r') as stream:
678676 data = stream.read()
679- @@ -623 ,14 +661 ,16 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
680- out += f "\n\nasv: failed to parse benchmark result: {exc }\n"
677+ @@ -631 ,14 +669 ,16 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
678+ out += "\n\nasv: failed to parse benchmark result: {0 }\n".format(exc)
681679
682680 # Special parsing for timing benchmark results
683681- if isinstance(data, dict) and 'samples' in data and 'number' in data:
@@ -694,7 +692,7 @@ index b5c6a7b..364ee95 100644
694692
695693 if benchmark['params'] and out:
696694 params, = itertools.islice(itertools.product(*benchmark['params']),
697- @@ -644 ,14 +684 ,22 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
695+ @@ -652 ,14 +692 ,22 @@ def _run_benchmark_single_param(benchmark, spawner, param_idx,
698696 else:
699697 profile_data = None
700698
@@ -726,10 +724,10 @@ index b5c6a7b..364ee95 100644
726724 spawner.interrupt()
727725 raise util.UserError("Interrupted.")
728726diff --git a/asv/util.py b/asv/util.py
729- index efed60d..0675bc1 100644
727+ index 52eb96e..1165020 100644
730728--- a/asv/util.py
731729+++ b/asv/util.py
732- @@ -523 ,7 +523 ,7 @@ def check_output(args, valid_return_codes=(0,), timeout=600, dots=True,
730+ @@ -543 ,7 +543 ,7 @@ def check_output(args, valid_return_codes=(0,), timeout=600, dots=True,
733731 kwargs['creationflags'] = subprocess.CREATE_NEW_PROCESS_GROUP
734732 else:
735733 kwargs['close_fds'] = True
@@ -1226,10 +1224,10 @@ index 0000000..3064adc
12261224+ });
12271225+ });
12281226diff --git a/asv/www/index.html b/asv/www/index.html
1229- index 5e2f651..8703284 100644
1227+ index d1651ba..c69a6f1 100644
12301228--- a/asv/www/index.html
12311229+++ b/asv/www/index.html
1232- @@ -33 ,6 +33 ,9 @@
1230+ @@ -59 ,6 +59 ,9 @@
12331231 <script language="javascript" type="text/javascript"
12341232 src="summarylist.js">
12351233 </script>
@@ -1239,23 +1237,23 @@ index 5e2f651..8703284 100644
12391237 <script language="javascript" type="text/javascript"
12401238 src="graphdisplay.js">
12411239 </script>
1242- @@ -42 ,6 +45 ,7 @@
1240+ @@ -68 ,6 +71 ,7 @@
12431241 <link href="asv.css" rel="stylesheet" type="text/css"/>
12441242 <link href="regressions.css" rel="stylesheet" type="text/css"/>
12451243 <link href="summarylist.css" rel="stylesheet" type="text/css"/>
12461244+ <link href="comparisonlist.css" rel="stylesheet" type="text/css"/>
12471245 <link rel="shortcut icon" href="swallow.ico"/>
12481246 <link rel="alternate" type="application/atom+xml" title="Regressions" href="regressions.xml"/>
12491247 </head>
1250- @@ -57 ,6 +61 ,7 @@
1248+ @@ -83 ,6 +87 ,7 @@
12511249 </li>
12521250 <li id="nav-li-" class="active"><a href="#/">Benchmark grid</a></li>
12531251 <li id="nav-li-summarylist"><a href="#/summarylist">Benchmark list</a></li>
12541252+ <li id="nav-li-comparisonlist"><a href="#/comparisonlist">Comparison list</a></li>
12551253 <li id="nav-li-regressions"><a href="#/regressions">Regressions</a></li>
12561254 <li id="nav-li-graphdisplay">
12571255 <span class="navbar-brand" id="title">
1258- @@ -73 ,6 +78 ,10 @@
1256+ @@ -99 ,6 +104 ,10 @@
12591257 <div id="summarylist-body" style="position: absolute; left: 200px; top: 55px; bottom: 0px; right: 0px; overflow-y: scroll;">
12601258 </div>
12611259 </div>
@@ -1267,7 +1265,7 @@ index 5e2f651..8703284 100644
12671265 <div id="graphdisplay-navigation" class="asv-navigation" style="position: absolute; left: 0; top: 55px; bottom: 0; width: 200px; overflow-y: scroll">
12681266 <div class="panel panel-default">
12691267diff --git a/docs/source/benchmarks.rst b/docs/source/benchmarks.rst
1270- index 16ac796..a13a6b8 100644
1268+ index 7a1e3a4..c8bf6eb 100644
12711269--- a/docs/source/benchmarks.rst
12721270+++ b/docs/source/benchmarks.rst
12731271@@ -114,6 +114,9 @@ Timing benchmarks
0 commit comments