Mercurial > hg
comparison contrib/perf.py @ 50677:b8de54ac5a21
perf: add a perf::stream-generate command
This record the time we take to generate a bundle.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Tue, 06 Jun 2023 04:09:05 +0200 |
parents | 28620be88da9 |
children | 459681233b1f |
comparison
equal
deleted
inserted
replaced
50676:28620be88da9 | 50677:b8de54ac5a21 |
---|---|
1990 | 1990 |
1991 timer(runone, setup=setupone, title=b"load") | 1991 timer(runone, setup=setupone, title=b"load") |
1992 fm.end() | 1992 fm.end() |
1993 | 1993 |
1994 | 1994 |
1995 @command( | |
1996 b'perf::stream-generate', | |
1997 [ | |
1998 ( | |
1999 b'', | |
2000 b'stream-version', | |
2001 b'latest', | |
2002 b'stream version to us ("v1", "v2" or "latest", (the default))', | |
2003 ), | |
2004 ] | |
2005 + formatteropts, | |
2006 ) | |
2007 def perf_stream_clone_generate(ui, repo, stream_version, **opts): | |
2008 """benchmark the full generation of a stream clone""" | |
2009 | |
2010 opts = _byteskwargs(opts) | |
2011 timer, fm = gettimer(ui, opts) | |
2012 | |
2013 # deletion of the generator may trigger some cleanup that we do not want to | |
2014 # measure | |
2015 | |
2016 generate = _find_stream_generator(stream_version) | |
2017 | |
2018 def runone(): | |
2019 # the lock is held for the duration the initialisation | |
2020 for chunk in generate(repo): | |
2021 pass | |
2022 | |
2023 timer(runone, title=b"generate") | |
2024 fm.end() | |
2025 | |
2026 | |
1995 @command(b'perf::parents|perfparents', formatteropts) | 2027 @command(b'perf::parents|perfparents', formatteropts) |
1996 def perfparents(ui, repo, **opts): | 2028 def perfparents(ui, repo, **opts): |
1997 """benchmark the time necessary to fetch one changeset's parents. | 2029 """benchmark the time necessary to fetch one changeset's parents. |
1998 | 2030 |
1999 The fetch is done using the `node identifier`, traversing all object layers | 2031 The fetch is done using the `node identifier`, traversing all object layers |