Mercurial > public > mercurial-scm > hg
comparison mercurial/debugcommands.py @ 35678:43154a76f392
debugdeltachain: display how many chunks would be read in sparse-read mode
author | Paul Morelle <paul.morelle@octobus.net> |
---|---|
date | Mon, 16 Oct 2017 14:32:06 +0200 |
parents | 35fb3367f72d |
children | 22a877215ea1 |
comparison
equal
deleted
inserted
replaced
35677:cf2e2a7399bc | 35678:43154a76f392 |
---|---|
598 | 598 |
599 :``readsize``: total size of data read from the disk for a revision | 599 :``readsize``: total size of data read from the disk for a revision |
600 (sum of the sizes of all the blocks) | 600 (sum of the sizes of all the blocks) |
601 :``largestblock``: size of the largest block of data read from the disk | 601 :``largestblock``: size of the largest block of data read from the disk |
602 :``readdensity``: density of useful bytes in the data read from the disk | 602 :``readdensity``: density of useful bytes in the data read from the disk |
603 :``srchunks``: in how many data hunks the whole revision would be read | |
603 | 604 |
604 The sparse read can be enabled with experimental.sparse-read = True | 605 The sparse read can be enabled with experimental.sparse-read = True |
605 """ | 606 """ |
606 opts = pycompat.byteskwargs(opts) | 607 opts = pycompat.byteskwargs(opts) |
607 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) | 608 r = cmdutil.openrevlog(repo, 'debugdeltachain', file_, opts) |
643 | 644 |
644 fm.plain(' rev chain# chainlen prev delta ' | 645 fm.plain(' rev chain# chainlen prev delta ' |
645 'size rawsize chainsize ratio lindist extradist ' | 646 'size rawsize chainsize ratio lindist extradist ' |
646 'extraratio') | 647 'extraratio') |
647 if withsparseread: | 648 if withsparseread: |
648 fm.plain(' readsize largestblk rddensity') | 649 fm.plain(' readsize largestblk rddensity srchunks') |
649 fm.plain('\n') | 650 fm.plain('\n') |
650 | 651 |
651 chainbases = {} | 652 chainbases = {} |
652 for rev in r: | 653 for rev in r: |
653 comp, uncomp, deltatype, chain, chainsize = revinfo(rev) | 654 comp, uncomp, deltatype, chain, chainsize = revinfo(rev) |
691 if largestblock < blksize: | 692 if largestblock < blksize: |
692 largestblock = blksize | 693 largestblock = blksize |
693 | 694 |
694 readdensity = float(chainsize) / float(readsize) | 695 readdensity = float(chainsize) / float(readsize) |
695 | 696 |
696 fm.write('readsize largestblock readdensity', | 697 if util.safehasattr(revlog, '_slicechunk'): |
697 ' %10d %10d %9.5f', | 698 revchunks = tuple(revlog._slicechunk(r, chain)) |
698 readsize, largestblock, readdensity, | 699 else: |
700 revchunks = (chain,) | |
701 srchunks = len(revchunks) | |
702 | |
703 fm.write('readsize largestblock readdensity srchunks', | |
704 ' %10d %10d %9.5f %8d', | |
705 readsize, largestblock, readdensity, srchunks, | |
699 readsize=readsize, largestblock=largestblock, | 706 readsize=readsize, largestblock=largestblock, |
700 readdensity=readdensity) | 707 readdensity=readdensity, srchunks=srchunks) |
701 | 708 |
702 fm.plain('\n') | 709 fm.plain('\n') |
703 | 710 |
704 fm.end() | 711 fm.end() |
705 | 712 |