perf: add a perf::stream-generate command
This record the time we take to generate a bundle.
--- a/contrib/perf.py Mon Jun 12 18:04:09 2023 +0200
+++ b/contrib/perf.py Tue Jun 06 04:09:05 2023 +0200
@@ -1992,6 +1992,38 @@
fm.end()
+@command(
+ b'perf::stream-generate',
+ [
+ (
+ b'',
+ b'stream-version',
+ b'latest',
+ b'stream version to us ("v1", "v2" or "latest", (the default))',
+ ),
+ ]
+ + formatteropts,
+)
+def perf_stream_clone_generate(ui, repo, stream_version, **opts):
+ """benchmark the full generation of a stream clone"""
+
+ opts = _byteskwargs(opts)
+ timer, fm = gettimer(ui, opts)
+
+ # deletion of the generator may trigger some cleanup that we do not want to
+ # measure
+
+ generate = _find_stream_generator(stream_version)
+
+ def runone():
+ # the lock is held for the duration the initialisation
+ for chunk in generate(repo):
+ pass
+
+ timer(runone, title=b"generate")
+ fm.end()
+
+
@command(b'perf::parents|perfparents', formatteropts)
def perfparents(ui, repo, **opts):
"""benchmark the time necessary to fetch one changeset's parents.
--- a/tests/test-contrib-perf.t Mon Jun 12 18:04:09 2023 +0200
+++ b/tests/test-contrib-perf.t Tue Jun 06 04:09:05 2023 +0200
@@ -188,6 +188,8 @@
perf::startup
(no help text available)
perf::status benchmark the performance of a single status call
+ perf::stream-generate
+ benchmark the full generation of a stream clone
perf::stream-locked-section
benchmark the initial, repo-locked, section of a stream-clone
perf::tags (no help text available)