Mercurial > hg-stable
view hgdemandimport/tracing.py @ 39508:4ca7a67c94c8
sparse-revlog: add a test checking revlog deltas for a churning file
The test repository contains 5000 revisions and is therefore slow to build:
five minutes with CHG, over fifteen minutes without. It is too slow to build
during the test. Bundling all content produce a sizeable result, 20BM, too
large to be committed. Instead, we commit a script to build the expected
bundle and the test checks if the bundle is available. Any run of the script
will produce the same repository content, using resulting in the same hashes.
Using smaller repositories was tried, however, it misses most of the cases we
are planning to improve. Having them in a 5000 repository is already nice, we
usually see these case in repositories in the order of magnitude of one
million revisions.
This test will be very useful to check various changes strategy for building
delta to store in a sparse-revlog.
In this series we will focus our attention on the following metrics:
The ones that will impact the final storage performance (size, space):
* size of the revlog data file (".hg/store/data/*.d")
* chain length info
The ones that describe the deltas patterns:
* number of snapshot revision (and their level)
* size taken by snapshot revision (and their level)
author | Boris Feld <boris.feld@octobus.net> |
---|---|
date | Mon, 10 Sep 2018 09:08:24 -0700 |
parents | 452790284a15 |
children | d0b8a3cfd732 |
line wrap: on
line source
# Support code for event tracing in Mercurial. Lives in demandimport # so it can also be used in demandimport. # # Copyright 2018 Google LLC. # # This software may be used and distributed according to the terms of the # GNU General Public License version 2 or any later version. from __future__ import absolute_import import contextlib import os _pipe = None _checked = False @contextlib.contextmanager def log(whencefmt, *whenceargs): global _pipe, _session, _checked if _pipe is None: if _checked: yield return _checked = True if 'HGCATAPULTSERVERPIPE' not in os.environ: yield return _pipe = open(os.environ['HGCATAPULTSERVERPIPE'], 'w', 1) _session = os.environ.get('HGCATAPULTSESSION', 'none') whence = whencefmt % whenceargs try: # Both writes to the pipe are wrapped in try/except to ignore # errors, as we can see mysterious errors in here if the pager # is active. Presumably other conditions could trigger # problems too. try: _pipe.write('START %s %s\n' % (_session, whence)) except IOError: pass yield finally: try: _pipe.write('END %s %s\n' % (_session, whence)) except IOError: pass