##// END OF EJS Templates
perf: introduce a `perf::stream-locked-section` command...
marmoute -
r51344:714b63a7 default
parent child Browse files
Show More
@@ -1900,6 +1900,57 b' def perfstartup(ui, repo, **opts):'
1900 fm.end()
1900 fm.end()
1901
1901
1902
1902
1903 @command(
1904 b'perf::stream-locked-section',
1905 [
1906 (
1907 b'',
1908 b'stream-version',
1909 b'latest',
1910 b'stream version to us ("v1", "v2" or "latest", (the default))',
1911 ),
1912 ]
1913 + formatteropts,
1914 )
1915 def perf_stream_clone_scan(ui, repo, stream_version, **opts):
1916 """benchmark the initial, repo-locked, section of a stream-clone"""
1917 import mercurial.streamclone
1918
1919 generatev1 = mercurial.streamclone.generatev1
1920 generatev2 = mercurial.streamclone.generatev2
1921
1922 opts = _byteskwargs(opts)
1923 timer, fm = gettimer(ui, opts)
1924
1925 # deletion of the generator may trigger some cleanup that we do not want to
1926 # measure
1927 result_holder = [None]
1928
1929 def setupone():
1930 result_holder[0] = None
1931
1932 def runone_v1():
1933 # the lock is held for the duration the initialisation
1934 result_holder[0] = generatev1(repo)
1935
1936 def runone_v2():
1937 # the lock is held for the duration the initialisation
1938 result_holder[0] = generatev2(repo, None, None, True)
1939
1940 if stream_version == b'latest':
1941 runone = runone_v2
1942 elif stream_version == b'v2':
1943 runone = runone_v2
1944 elif stream_version == b'v1':
1945 runone = runone_v1
1946 else:
1947 msg = b'unknown stream version: "%s"' % stream_version
1948 raise error.Abort(msg)
1949
1950 timer(runone, setup=setupone, title=b"load")
1951 fm.end()
1952
1953
1903 @command(b'perf::parents|perfparents', formatteropts)
1954 @command(b'perf::parents|perfparents', formatteropts)
1904 def perfparents(ui, repo, **opts):
1955 def perfparents(ui, repo, **opts):
1905 """benchmark the time necessary to fetch one changeset's parents.
1956 """benchmark the time necessary to fetch one changeset's parents.
@@ -188,6 +188,8 b' perfstatus'
188 perf::startup
188 perf::startup
189 (no help text available)
189 (no help text available)
190 perf::status benchmark the performance of a single status call
190 perf::status benchmark the performance of a single status call
191 perf::stream-locked-section
192 benchmark the initial, repo-locked, section of a stream-clone
191 perf::tags (no help text available)
193 perf::tags (no help text available)
192 perf::templating
194 perf::templating
193 test the rendering time of a given template
195 test the rendering time of a given template
General Comments 0
You need to be logged in to leave comments. Login now