New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make Profile.print_stats support sorting by mutiple values #69990
Comments
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) >>> 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) >>> 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) |
It would be good to add test for this. |
Attached refactored patch with tests. |
Patch looks good to me |
@wdv4758h, do you think you will be able to resubmit the patch to Github? This would probably still be a useful addition and some review has already been done. If not, I could pick up the patch and re-submit, but I don't want to take credit for your work unnecessarily. |
The PR is ready for review. |
…GH-104590) Co-authored-by: Chiu-Hsiang Hsu
…values (pythonGH-104590) Co-authored-by: Chiu-Hsiang Hsu
…values (pythonGH-104590) Co-authored-by: Chiu-Hsiang Hsu
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
Linked PRs
The text was updated successfully, but these errors were encountered: