Thanks to visit codestin.com Credit goes to github.com
We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 8ef519b commit 21101f7Copy full SHA for 21101f7
1 file changed
Doc/library/profile.rst
@@ -247,11 +247,13 @@ functions:
247
import cProfile, pstats, io
248
pr = cProfile.Profile()
249
pr.enable()
250
- ... do something ...
+ # ... do something ...
251
pr.disable()
252
s = io.StringIO()
253
- ps = pstats.Stats(pr, stream=s)
254
- ps.print_results()
+ sortby = 'cumulative'
+ ps = pstats.Stats(pr, stream=s).sort_stats(sortby)
255
+ ps.print_stats()
256
+ print(s.getvalue())
257
258
.. method:: enable()
259
0 commit comments