Mercurial > hg
comparison mercurial/debugcommands.py @ 33057:03eefca3ed33
debugrevlog: also display the largest delta chain span
Mercurial read all data between the base of the chain and the last delta when
restoring content (including unrelated delta). To monitor this, we add data
about the size of the "delta chain span" to debugrevlog.
author | Pierre-Yves David <pierre-yves.david@octobus.net> |
---|---|
date | Fri, 23 Jun 2017 01:38:10 +0200 |
parents | e8c8d81eb864 |
children | e21b750c9b9e |
comparison
equal
deleted
inserted
replaced
33056:2312e70cf78b | 33057:03eefca3ed33 |
---|---|
1747 nump2 = 0 | 1747 nump2 = 0 |
1748 numother = 0 | 1748 numother = 0 |
1749 nump1prev = 0 | 1749 nump1prev = 0 |
1750 nump2prev = 0 | 1750 nump2prev = 0 |
1751 chainlengths = [] | 1751 chainlengths = [] |
1752 chainbases = [] | |
1753 chainspans = [] | |
1752 | 1754 |
1753 datasize = [None, 0, 0] | 1755 datasize = [None, 0, 0] |
1754 fullsize = [None, 0, 0] | 1756 fullsize = [None, 0, 0] |
1755 deltasize = [None, 0, 0] | 1757 deltasize = [None, 0, 0] |
1756 chunktypecounts = {} | 1758 chunktypecounts = {} |
1772 if p2 != nullrev: | 1774 if p2 != nullrev: |
1773 nummerges += 1 | 1775 nummerges += 1 |
1774 size = r.length(rev) | 1776 size = r.length(rev) |
1775 if delta == nullrev: | 1777 if delta == nullrev: |
1776 chainlengths.append(0) | 1778 chainlengths.append(0) |
1779 chainbases.append(r.start(rev)) | |
1780 chainspans.append(size) | |
1777 numfull += 1 | 1781 numfull += 1 |
1778 addsize(size, fullsize) | 1782 addsize(size, fullsize) |
1779 else: | 1783 else: |
1780 chainlengths.append(chainlengths[delta] + 1) | 1784 chainlengths.append(chainlengths[delta] + 1) |
1785 baseaddr = chainbases[delta] | |
1786 revaddr = r.start(rev) | |
1787 chainbases.append(baseaddr) | |
1788 chainspans.append((revaddr - baseaddr) + size) | |
1781 addsize(size, deltasize) | 1789 addsize(size, deltasize) |
1782 if delta == rev - 1: | 1790 if delta == rev - 1: |
1783 numprev += 1 | 1791 numprev += 1 |
1784 if delta == p1: | 1792 if delta == p1: |
1785 nump1prev += 1 | 1793 nump1prev += 1 |
1821 if numrevs - numfull > 0: | 1829 if numrevs - numfull > 0: |
1822 deltasize[2] /= numrevs - numfull | 1830 deltasize[2] /= numrevs - numfull |
1823 totalsize = fulltotal + deltatotal | 1831 totalsize = fulltotal + deltatotal |
1824 avgchainlen = sum(chainlengths) / numrevs | 1832 avgchainlen = sum(chainlengths) / numrevs |
1825 maxchainlen = max(chainlengths) | 1833 maxchainlen = max(chainlengths) |
1834 maxchainspan = max(chainspans) | |
1826 compratio = 1 | 1835 compratio = 1 |
1827 if totalsize: | 1836 if totalsize: |
1828 compratio = totalrawsize / totalsize | 1837 compratio = totalrawsize / totalsize |
1829 | 1838 |
1830 basedfmtstr = '%%%dd\n' | 1839 basedfmtstr = '%%%dd\n' |
1877 | 1886 |
1878 ui.write('\n') | 1887 ui.write('\n') |
1879 fmt = dfmtstr(max(avgchainlen, compratio)) | 1888 fmt = dfmtstr(max(avgchainlen, compratio)) |
1880 ui.write(('avg chain length : ') + fmt % avgchainlen) | 1889 ui.write(('avg chain length : ') + fmt % avgchainlen) |
1881 ui.write(('max chain length : ') + fmt % maxchainlen) | 1890 ui.write(('max chain length : ') + fmt % maxchainlen) |
1891 ui.write(('max chain reach : ') + fmt % maxchainspan) | |
1882 ui.write(('compression ratio : ') + fmt % compratio) | 1892 ui.write(('compression ratio : ') + fmt % compratio) |
1883 | 1893 |
1884 if format > 0: | 1894 if format > 0: |
1885 ui.write('\n') | 1895 ui.write('\n') |
1886 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') | 1896 ui.write(('uncompressed data size (min/max/avg) : %d / %d / %d\n') |