##// END OF EJS Templates
perf: add a --stats argument to perfhelper-pathcopies...
marmoute -
r43212:adac17fa default
parent child Browse files
Show More
@@ -1745,6 +1745,7 b' def perfhelpermergecopies(ui, repo, revs'
1745 [
1745 [
1746 (b'r', b'revs', [], b'restrict search to these revisions'),
1746 (b'r', b'revs', [], b'restrict search to these revisions'),
1747 (b'', b'timing', False, b'provides extra data (costly)'),
1747 (b'', b'timing', False, b'provides extra data (costly)'),
1748 (b'', b'stats', False, b'provides statistic about the measured data'),
1748 ])
1749 ])
1749 def perfhelperpathcopies(ui, repo, revs=[], **opts):
1750 def perfhelperpathcopies(ui, repo, revs=[], **opts):
1750 """find statistic about potential parameters for the `perftracecopies`
1751 """find statistic about potential parameters for the `perftracecopies`
@@ -1763,6 +1764,7 b' def perfhelperpathcopies(ui, repo, revs='
1763 opts = _byteskwargs(opts)
1764 opts = _byteskwargs(opts)
1764 fm = ui.formatter(b'perf', opts)
1765 fm = ui.formatter(b'perf', opts)
1765 dotiming = opts[b'timing']
1766 dotiming = opts[b'timing']
1767 dostats = opts[b'stats']
1766
1768
1767 if dotiming:
1769 if dotiming:
1768 header = '%12s %12s %12s %12s %12s %12s\n'
1770 header = '%12s %12s %12s %12s %12s %12s\n'
@@ -1782,6 +1784,16 b' def perfhelperpathcopies(ui, repo, revs='
1782 revs = ['all()']
1784 revs = ['all()']
1783 revs = scmutil.revrange(repo, revs)
1785 revs = scmutil.revrange(repo, revs)
1784
1786
1787
1788 if dostats:
1789 alldata = {
1790 'nbrevs': [],
1791 'nbmissingfiles': [],
1792 }
1793 if dotiming:
1794 alldata['nbrenames'] = []
1795 alldata['time'] = []
1796
1785 roi = repo.revs('merge() and %ld', revs)
1797 roi = repo.revs('merge() and %ld', revs)
1786 for r in roi:
1798 for r in roi:
1787 ctx = repo[r]
1799 ctx = repo[r]
@@ -1801,6 +1813,16 b' def perfhelperpathcopies(ui, repo, revs='
1801 b'nbrevs': len(repo.revs('%d::%d', b, p)),
1813 b'nbrevs': len(repo.revs('%d::%d', b, p)),
1802 b'nbmissingfiles': len(missing),
1814 b'nbmissingfiles': len(missing),
1803 }
1815 }
1816 alldata['nbrevs'].append((
1817 data['nbrevs'],
1818 base.hex(),
1819 parent.hex(),
1820 ))
1821 alldata['nbmissingfiles'].append((
1822 data['nbmissingfiles'],
1823 base.hex(),
1824 parent.hex(),
1825 ))
1804 if dotiming:
1826 if dotiming:
1805 begin = util.timer()
1827 begin = util.timer()
1806 renames = copies.pathcopies(base, parent)
1828 renames = copies.pathcopies(base, parent)
@@ -1808,6 +1830,16 b' def perfhelperpathcopies(ui, repo, revs='
1808 # not very stable timing since we did only one run
1830 # not very stable timing since we did only one run
1809 data['time'] = end - begin
1831 data['time'] = end - begin
1810 data['nbrenamedfiles'] = len(renames)
1832 data['nbrenamedfiles'] = len(renames)
1833 alldata['time'].append((
1834 data['time'],
1835 base.hex(),
1836 parent.hex(),
1837 ))
1838 alldata['nbrenames'].append((
1839 data['nbrenamedfiles'],
1840 base.hex(),
1841 parent.hex(),
1842 ))
1811 fm.startitem()
1843 fm.startitem()
1812 fm.data(**data)
1844 fm.data(**data)
1813 out = data.copy()
1845 out = data.copy()
@@ -1816,6 +1848,19 b' def perfhelperpathcopies(ui, repo, revs='
1816 fm.plain(output % out)
1848 fm.plain(output % out)
1817
1849
1818 fm.end()
1850 fm.end()
1851 if dostats:
1852 # use a second formatter because the data are quite different, not sure
1853 # how it flies with the templater.
1854 fm = ui.formatter(b'perf', opts)
1855 entries = [
1856 ('nbrevs', 'number of revision covered'),
1857 ('nbmissingfiles', 'number of missing files at head'),
1858 ]
1859 if dotiming:
1860 entries.append(('nbrenames',
1861 'renamed files'))
1862 entries.append(('time', 'time'))
1863 _displaystats(ui, opts, entries, alldata)
1819
1864
1820 @command(b'perfcca', formatteropts)
1865 @command(b'perfcca', formatteropts)
1821 def perfcca(ui, repo, **opts):
1866 def perfcca(ui, repo, **opts):
General Comments 0
You need to be logged in to leave comments. Login now