[issue25804] Make Profile.print_stats support sorting by mutiple values
Chiu-Hsiang Hsu
report at bugs.python.org
Sat Dec 5 03:25:52 EST 2015
New submission from Chiu-Hsiang Hsu:
Currently, the result of profile.run can not easily sort by mutiple values with "sort" keyword argument. Following code will work with this patch.
>>> import cProfile
>>> cProfile.run('42**42', sort=('tottime', 'stdname'))
3 function calls in 0.000 seconds
Ordered by: internal time, standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> import cProfile
>>> cProfile.run('42**42', sort=('tottime', 'stdname'))
3 function calls in 0.000 seconds
Ordered by: internal time, standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 {built-in method builtins.exec}
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
1 0.000 0.000 0.000 0.000 {method 'disable' of '_lsprof.Profiler' objects}
>>> import profile
>>> profile.run('42**42', sort=('tottime', 'stdname'))
4 function calls in 0.000 seconds
Ordered by: internal time, standard name
ncalls tottime percall cumtime percall filename:lineno(function)
1 0.000 0.000 0.000 0.000 profile:0(42**42)
1 0.000 0.000 0.000 0.000 :0(exec)
1 0.000 0.000 0.000 0.000 :0(setprofile)
1 0.000 0.000 0.000 0.000 <string>:1(<module>)
0 0.000 0.000 profile:0(profiler)
----------
components: Library (Lib)
files: print_stats.patch
keywords: patch
messages: 255935
nosy: wdv4758h
priority: normal
severity: normal
status: open
title: Make Profile.print_stats support sorting by mutiple values
type: enhancement
versions: Python 3.6
Added file: http://bugs.python.org/file41247/print_stats.patch
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue25804>
_______________________________________
More information about the Python-bugs-list
mailing list