comparison mercurial/statprof.py @ 48935:2cce2fa5bcf7

py3: replace pycompat.itervalues(x) with x.values() pycompat.itervalues(x) just calls x.values(). So this is equivalent. The rewrite was perfomed via an automated search and replace. Differential Revision: https://phab.mercurial-scm.org/D12341
author Gregory Szorc <gregory.szorc@gmail.com>
date Tue, 01 Mar 2022 20:52:32 -0800
parents f254fc73d956
children 37537a4d2695
comparison
equal deleted inserted replaced
48934:06de08b36c82 48935:2cce2fa5bcf7
472 sitestat.addtotal() 472 sitestat.addtotal()
473 473
474 if i == 0: 474 if i == 0:
475 sitestat.addself() 475 sitestat.addself()
476 476
477 return [s for s in pycompat.itervalues(stats)] 477 return [s for s in stats.values()]
478 478
479 479
480 class DisplayFormats: 480 class DisplayFormats:
481 ByLine = 0 481 ByLine = 0
482 ByMethod = 1 482 ByMethod = 1
743 showtime = kwargs.get('showtime', True) 743 showtime = kwargs.get('showtime', True)
744 744
745 def _write(node, depth, multiple_siblings): 745 def _write(node, depth, multiple_siblings):
746 site = node.site 746 site = node.site
747 visiblechildren = [ 747 visiblechildren = [
748 c 748 c for c in node.children.values() if c.count >= (limit * root.count)
749 for c in pycompat.itervalues(node.children)
750 if c.count >= (limit * root.count)
751 ] 749 ]
752 if site: 750 if site:
753 indent = depth * 2 - 1 751 indent = depth * 2 - 1
754 filename = (site.filename() + b':').ljust(15) 752 filename = (site.filename() + b':').ljust(15)
755 function = site.function 753 function = site.function
781 b''.ljust(max(0, 4 - len(str(site.lineno)))), 779 b''.ljust(max(0, 4 - len(str(site.lineno)))),
782 site.getsource(30), 780 site.getsource(30),
783 ) 781 )
784 782
785 finalstring = liststring + codestring 783 finalstring = liststring + codestring
786 childrensamples = sum( 784 childrensamples = sum([c.count for c in node.children.values()])
787 [c.count for c in pycompat.itervalues(node.children)]
788 )
789 # Make frames that performed more than 10% of the operation red 785 # Make frames that performed more than 10% of the operation red
790 if node.count - childrensamples > (0.1 * root.count): 786 if node.count - childrensamples > (0.1 * root.count):
791 finalstring = b'\033[91m' + finalstring + b'\033[0m' 787 finalstring = b'\033[91m' + finalstring + b'\033[0m'
792 # Make frames that didn't actually perform work dark grey 788 # Make frames that didn't actually perform work dark grey
793 elif node.count - childrensamples == 0: 789 elif node.count - childrensamples == 0: