Show More
@@ -1502,10 +1502,57 b' def perftemplating(ui, repo, testedtempl' | |||||
1502 | timer(format) |
|
1502 | timer(format) | |
1503 | fm.end() |
|
1503 | fm.end() | |
1504 |
|
1504 | |||
|
1505 | def _displaystats(ui, opts, entries, data): | |||
|
1506 | pass | |||
|
1507 | # use a second formatter because the data are quite different, not sure | |||
|
1508 | # how it flies with the templater. | |||
|
1509 | fm = ui.formatter(b'perf-stats', opts) | |||
|
1510 | for key, title in entries: | |||
|
1511 | values = data[key] | |||
|
1512 | nbvalues = len(data) | |||
|
1513 | values.sort() | |||
|
1514 | stats = { | |||
|
1515 | 'key': key, | |||
|
1516 | 'title': title, | |||
|
1517 | 'nbitems': len(values), | |||
|
1518 | 'min': values[0][0], | |||
|
1519 | '10%': values[(nbvalues * 10) // 100][0], | |||
|
1520 | '25%': values[(nbvalues * 25) // 100][0], | |||
|
1521 | '50%': values[(nbvalues * 50) // 100][0], | |||
|
1522 | '75%': values[(nbvalues * 75) // 100][0], | |||
|
1523 | '80%': values[(nbvalues * 80) // 100][0], | |||
|
1524 | '85%': values[(nbvalues * 85) // 100][0], | |||
|
1525 | '90%': values[(nbvalues * 90) // 100][0], | |||
|
1526 | '95%': values[(nbvalues * 95) // 100][0], | |||
|
1527 | '99%': values[(nbvalues * 99) // 100][0], | |||
|
1528 | 'max': values[-1][0], | |||
|
1529 | } | |||
|
1530 | fm.startitem() | |||
|
1531 | fm.data(**stats) | |||
|
1532 | # make node pretty for the human output | |||
|
1533 | fm.plain('### %s (%d items)\n' % (title, len(values))) | |||
|
1534 | lines = [ | |||
|
1535 | 'min', | |||
|
1536 | '10%', | |||
|
1537 | '25%', | |||
|
1538 | '50%', | |||
|
1539 | '75%', | |||
|
1540 | '80%', | |||
|
1541 | '85%', | |||
|
1542 | '90%', | |||
|
1543 | '95%', | |||
|
1544 | '99%', | |||
|
1545 | 'max', | |||
|
1546 | ] | |||
|
1547 | for l in lines: | |||
|
1548 | fm.plain('%s: %s\n' % (l, stats[l])) | |||
|
1549 | fm.end() | |||
|
1550 | ||||
1505 | @command(b'perfhelper-mergecopies', formatteropts + |
|
1551 | @command(b'perfhelper-mergecopies', formatteropts + | |
1506 | [ |
|
1552 | [ | |
1507 | (b'r', b'revs', [], b'restrict search to these revisions'), |
|
1553 | (b'r', b'revs', [], b'restrict search to these revisions'), | |
1508 | (b'', b'timing', False, b'provides extra data (costly)'), |
|
1554 | (b'', b'timing', False, b'provides extra data (costly)'), | |
|
1555 | (b'', b'stats', False, b'provides statistic about the measured data'), | |||
1509 | ]) |
|
1556 | ]) | |
1510 | def perfhelpermergecopies(ui, repo, revs=[], **opts): |
|
1557 | def perfhelpermergecopies(ui, repo, revs=[], **opts): | |
1511 | """find statistics about potential parameters for `perfmergecopies` |
|
1558 | """find statistics about potential parameters for `perfmergecopies` | |
@@ -1525,6 +1572,7 b' def perfhelpermergecopies(ui, repo, revs' | |||||
1525 | opts = _byteskwargs(opts) |
|
1572 | opts = _byteskwargs(opts) | |
1526 | fm = ui.formatter(b'perf', opts) |
|
1573 | fm = ui.formatter(b'perf', opts) | |
1527 | dotiming = opts[b'timing'] |
|
1574 | dotiming = opts[b'timing'] | |
|
1575 | dostats = opts[b'stats'] | |||
1528 |
|
1576 | |||
1529 | output_template = [ |
|
1577 | output_template = [ | |
1530 | ("base", "%(base)12s"), |
|
1578 | ("base", "%(base)12s"), | |
@@ -1553,6 +1601,17 b' def perfhelpermergecopies(ui, repo, revs' | |||||
1553 | revs = ['all()'] |
|
1601 | revs = ['all()'] | |
1554 | revs = scmutil.revrange(repo, revs) |
|
1602 | revs = scmutil.revrange(repo, revs) | |
1555 |
|
1603 | |||
|
1604 | if dostats: | |||
|
1605 | alldata = { | |||
|
1606 | 'nbrevs': [], | |||
|
1607 | 'nbmissingfiles': [], | |||
|
1608 | } | |||
|
1609 | if dotiming: | |||
|
1610 | alldata['parentnbrenames'] = [] | |||
|
1611 | alldata['totalnbrenames'] = [] | |||
|
1612 | alldata['parenttime'] = [] | |||
|
1613 | alldata['totaltime'] = [] | |||
|
1614 | ||||
1556 | roi = repo.revs('merge() and %ld', revs) |
|
1615 | roi = repo.revs('merge() and %ld', revs) | |
1557 | for r in roi: |
|
1616 | for r in roi: | |
1558 | ctx = repo[r] |
|
1617 | ctx = repo[r] | |
@@ -1572,6 +1631,29 b' def perfhelpermergecopies(ui, repo, revs' | |||||
1572 | b'p2.nbrevs': len(repo.revs('%d::%d', b.rev(), p2.rev())), |
|
1631 | b'p2.nbrevs': len(repo.revs('%d::%d', b.rev(), p2.rev())), | |
1573 | b'p2.nbmissingfiles': len(p2missing), |
|
1632 | b'p2.nbmissingfiles': len(p2missing), | |
1574 | } |
|
1633 | } | |
|
1634 | if dostats: | |||
|
1635 | if p1missing: | |||
|
1636 | alldata['nbrevs'].append(( | |||
|
1637 | data['p1.nbrevs'], | |||
|
1638 | b.hex(), | |||
|
1639 | p1.hex() | |||
|
1640 | )) | |||
|
1641 | alldata['nbmissingfiles'].append(( | |||
|
1642 | data['p1.nbmissingfiles'], | |||
|
1643 | b.hex(), | |||
|
1644 | p1.hex() | |||
|
1645 | )) | |||
|
1646 | if p2missing: | |||
|
1647 | alldata['nbrevs'].append(( | |||
|
1648 | data['p2.nbrevs'], | |||
|
1649 | b.hex(), | |||
|
1650 | p2.hex() | |||
|
1651 | )) | |||
|
1652 | alldata['nbmissingfiles'].append(( | |||
|
1653 | data['p2.nbmissingfiles'], | |||
|
1654 | b.hex(), | |||
|
1655 | p2.hex() | |||
|
1656 | )) | |||
1575 | if dotiming: |
|
1657 | if dotiming: | |
1576 | begin = util.timer() |
|
1658 | begin = util.timer() | |
1577 | mergedata = copies.mergecopies(repo, p1, p2, b) |
|
1659 | mergedata = copies.mergecopies(repo, p1, p2, b) | |
@@ -1596,6 +1678,43 b' def perfhelpermergecopies(ui, repo, revs' | |||||
1596 | end = util.timer() |
|
1678 | end = util.timer() | |
1597 | data['p1.renamedfiles'] = len(p1renames) |
|
1679 | data['p1.renamedfiles'] = len(p1renames) | |
1598 | data['p2.renamedfiles'] = len(p2renames) |
|
1680 | data['p2.renamedfiles'] = len(p2renames) | |
|
1681 | ||||
|
1682 | if dostats: | |||
|
1683 | if p1missing: | |||
|
1684 | alldata['parentnbrenames'].append(( | |||
|
1685 | data['p1.renamedfiles'], | |||
|
1686 | b.hex(), | |||
|
1687 | p1.hex() | |||
|
1688 | )) | |||
|
1689 | alldata['parenttime'].append(( | |||
|
1690 | data['p1.time'], | |||
|
1691 | b.hex(), | |||
|
1692 | p1.hex() | |||
|
1693 | )) | |||
|
1694 | if p2missing: | |||
|
1695 | alldata['parentnbrenames'].append(( | |||
|
1696 | data['p2.renamedfiles'], | |||
|
1697 | b.hex(), | |||
|
1698 | p2.hex() | |||
|
1699 | )) | |||
|
1700 | alldata['parenttime'].append(( | |||
|
1701 | data['p2.time'], | |||
|
1702 | b.hex(), | |||
|
1703 | p2.hex() | |||
|
1704 | )) | |||
|
1705 | if p1missing or p2missing: | |||
|
1706 | alldata['totalnbrenames'].append(( | |||
|
1707 | data['nbrenamedfiles'], | |||
|
1708 | b.hex(), | |||
|
1709 | p1.hex(), | |||
|
1710 | p2.hex() | |||
|
1711 | )) | |||
|
1712 | alldata['totaltime'].append(( | |||
|
1713 | data['time'], | |||
|
1714 | b.hex(), | |||
|
1715 | p1.hex(), | |||
|
1716 | p2.hex() | |||
|
1717 | )) | |||
1599 | fm.startitem() |
|
1718 | fm.startitem() | |
1600 | fm.data(**data) |
|
1719 | fm.data(**data) | |
1601 | # make node pretty for the human output |
|
1720 | # make node pretty for the human output | |
@@ -1606,6 +1725,21 b' def perfhelpermergecopies(ui, repo, revs' | |||||
1606 | fm.plain(output % out) |
|
1725 | fm.plain(output % out) | |
1607 |
|
1726 | |||
1608 | fm.end() |
|
1727 | fm.end() | |
|
1728 | if dostats: | |||
|
1729 | # use a second formatter because the data are quite different, not sure | |||
|
1730 | # how it flies with the templater. | |||
|
1731 | entries = [ | |||
|
1732 | ('nbrevs', 'number of revision covered'), | |||
|
1733 | ('nbmissingfiles', 'number of missing files at head'), | |||
|
1734 | ] | |||
|
1735 | if dotiming: | |||
|
1736 | entries.append(('parentnbrenames', | |||
|
1737 | 'rename from one parent to base')) | |||
|
1738 | entries.append(('totalnbrenames', 'total number of renames')) | |||
|
1739 | entries.append(('parenttime', 'time for one parent')) | |||
|
1740 | entries.append(('totaltime', 'time for both parents')) | |||
|
1741 | _displaystats(ui, opts, entries, alldata) | |||
|
1742 | ||||
1609 |
|
1743 | |||
1610 | @command(b'perfhelper-pathcopies', formatteropts + |
|
1744 | @command(b'perfhelper-pathcopies', formatteropts + | |
1611 | [ |
|
1745 | [ |
General Comments 0
You need to be logged in to leave comments.
Login now