homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: pstats: sub-millisecond display
Type: enhancement Stage: patch review
Components: Library (Lib) Versions: Python 3.8
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: Nosy List: Romuald, georg.brandl, methane, ned.deily, serhiy.storchaka, vstinner
Priority: normal Keywords: patch

Created on 2015年04月30日 16:27 by Romuald, last changed 2022年04月11日 14:58 by admin.

Files
File name Uploaded Description Edit
pstats-microseconds.patch Romuald, 2015年04月30日 16:27 review
Pull Requests
URL Status Linked Edit
PR 3931 open python-dev, 2017年10月09日 13:32
Messages (6)
msg242277 - (view) Author: Romuald Brunet (Romuald) * Date: 2015年04月30日 16:27
When running pstats with functions that take less than 0.5 millisecond (per call for example), the value shown is '0.000, which isn't really helpful.
This patch aims to show the value in microseconds instead of seconds for values that would otherwise be displayed as '0.000'
(the display may have to be tweaked for non-utf8 users, as the μ character is used)
Example output:
 ncalls tottime percall cumtime percall filename:lineno(function)
 9827 0.007 7μs 0.007 7μs {method 'get' of 'dict' objects}
 3427 0.009 25μs 0.017 49μs {map}
 10701 0.006 5μs 0.006 5μs {method 'lower' of 'str' objects}
 31410 0.045 14μs 0.045 14μs {method 'split' of 'str' objects}
 10023 0.006 6μs 0.006 6μs {_weakref.proxy}
 31801 0.009 2μs 0.009 2μs {len}
 3892 0.003 7μs 0.003 7μs {method 'extend' of 'list' objects}
 1397 0.001 8μs 0.001 8μs {method 'replace' of 'str' objects}
 10488 0.010 9μs 0.010 9μs {method 'string_literal' of '_mysql.connection' objects}
 10702 2.620 2447μs 2.620 2447μs {method 'readline' of 'file' objects}
 10023 0.004 3μs 0.004 3μs {method 'info' of '_mysql.connection' objects}
 10023 0.005 5μs 0.005 5μs {method 'insert_id' of '_mysql.connection' objects}
 14327 0.022 15μs 0.022 15μs {method 'rstrip' of 'str' objects}
msg303966 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017年10月09日 15:00
Hum, "2447μs" makes the output more difficult to parse (by a program) and to read (by a human). Why not always displaying 6 digits (after the dot) for the two "percall" columns.
msg303981 - (view) Author: Romuald Brunet (Romuald) * Date: 2017年10月09日 15:58
I figured we didn't want to change the size of the columns (+12 COL), but this could easily be done yes
msg304248 - (view) Author: Serhiy Storchaka (serhiy.storchaka) * (Python committer) Date: 2017年10月12日 14:52
I concur with Victor. This change likely breaks graphical viewers of pstat data.
How gprof and similar tools solve the problem of outputting sub-millisecond timings?
msg304249 - (view) Author: STINNER Victor (vstinner) * (Python committer) Date: 2017年10月12日 14:58
> I concur with Victor. This change likely breaks graphical viewers of pstat data.
I propose to *do* break the format by always displaying percall timings with a precision of 6 digits.
msg313498 - (view) Author: Ned Deily (ned.deily) * (Python committer) Date: 2018年03月09日 20:25
Based on the review comments, it looks like the existing PR 3931 needs to be revised and resubmitted against current master branch. So, can we close PR 3931?
History
Date User Action Args
2022年04月11日 14:58:16adminsetgithub: 68272
2019年11月22日 12:37:17methanesetnosy: + methane
2018年03月09日 20:25:05ned.deilysetnosy: + ned.deily

messages: + msg313498
versions: + Python 3.8, - Python 3.5
2017年10月12日 14:58:05vstinnersetmessages: + msg304249
2017年10月12日 14:52:51serhiy.storchakasetmessages: + msg304248
2017年10月12日 14:52:35serhiy.storchakasetmessages: - msg304247
2017年10月12日 14:51:47serhiy.storchakasetnosy: + serhiy.storchaka
messages: + msg304247
2017年10月09日 15:58:38Romualdsetmessages: + msg303981
2017年10月09日 15:00:43vstinnersetnosy: + vstinner
messages: + msg303966
2017年10月09日 13:32:50python-devsetpull_requests: + pull_request3906
2015年04月30日 21:30:19ned.deilysetnosy: + georg.brandl
stage: patch review

versions: + Python 3.5
2015年04月30日 16:27:51Romualdcreate

AltStyle によって変換されたページ (->オリジナル) /