[issue24084] pstats: sub-millisecond display

Romuald Brunet report at bugs.python.org
Thu Apr 30 18:27:51 CEST 2015


New submission from Romuald Brunet:

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}

----------
components: Library (Lib)
files: pstats-microseconds.patch
keywords: patch
messages: 242277
nosy: Romuald
priority: normal
severity: normal
status: open
title: pstats: sub-millisecond display
type: enhancement
Added file: http://bugs.python.org/file39237/pstats-microseconds.patch

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24084>
_______________________________________


More information about the Python-bugs-list mailing list