• Home
  • Raw
  • Download

Lines Matching +full:- +full:- +full:statistics

9 --------------
11 .. _profiler-introduction:
21 Python programs. A :dfn:`profile` is a set of statistics that describes how
22 often and for how long various parts of the program executed. These statistics
29 reasonable overhead that makes it suitable for profiling long-running
41 Now also reports the time spent in calls to built-in functions
46 post-processing times. It is no longer maintained and may be
67 but not for C-level functions, and so the C code would seem faster than any
71 .. _profile-instant:
115 calls to sub-functions)
149 python -m cProfile [-o output_file] [-s sort_order] myscript.py
151 ``-o`` writes the profile results to a file instead of to stdout
153 ``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort
154 the output by. This only applies when ``-o`` is not supplied.
161 p.strip_dirs().sort_stats(-1).print_stats()
166 :meth:`~pstats.Stats.print_stats` method printed out all the statistics. You
173 will print out the statistics. The following are some interesting calls to
188 statistics for the top ten functions.
194 This will sort all the statistics by file name, and then print out statistics
200 This line sorts statistics with a primary key of time, and a secondary key of
201 cumulative time, and then prints out some of the statistics. To be specific, the
203 lines containing ``init`` are maintained, and that sub-sub-list is printed.
218 Invoked as a script, the :mod:`pstats` module is a statistics browser for
219 reading and examining profile dumps. It has a simple line-oriented interface
232 .. function:: run(command, filename=None, sort=-1)
239 and gathers profiling statistics from the execution. If no file name is
253 and gathers profiling statistics as in the :func:`run` function above.
294 .. method:: print_stats(sort=-1)
316 .. _profile-stats:
324 :synopsis: Statistics object for use with the profiler.
328 This class constructor creates an instance of a "statistics object" from a
337 several files are provided, all the statistics for identical functions will
358 have the same function name), then the statistics for these two entries
367 or :func:`cProfile.run`. Statistics for identically named (re: file, line,
369 statistics.
397 +------------------+----------------------+
401 +------------------+----------------------+
403 +------------------+----------------------+
405 +------------------+----------------------+
407 +------------------+----------------------+
409 +------------------+----------------------+
411 +------------------+----------------------+
413 +------------------+----------------------+
415 +------------------+----------------------+
417 +------------------+----------------------+
419 +------------------+----------------------+
421 +------------------+----------------------+
423 +------------------+----------------------+
425 +------------------+----------------------+
427 +------------------+----------------------+
429 Note that all sorts on statistics are in descending order (placing most
440 For backward-compatibility reasons, the numeric arguments ``-1``, ``0``,
500 second non-parenthesized number repeats the cumulative time spent in the
517 .. _deterministic-profiling:
537 not that expensive, yet provides extensive run time statistics about the
540 Call count statistics can be used to identify bugs in code (surprising counts),
541 and to identify possible inline-expansion points (high call counts). Internal
542 time statistics can be used to identify "hot loops" that should be carefully
543 optimized. Cumulative time statistics should be used to identify high level
545 cumulative times in this profiler allows statistics for recursive
550 .. _profile-limitations:
573 The problem is more important with :mod:`profile` than with the lower-overhead
579 probability work against you :-). ) Do *not* be alarmed by negative numbers in
584 .. _profile-calibration:
593 :ref:`profile-limitations`). ::
604 the timer, the magical number is about 4.04e-6.
625 your results will "less often" show up as negative in profile statistics.
627 .. _profile-timers:
633 of wall-clock time or elapsed process time), pass the timing function you want
650 that you choose (see :ref:`profile-calibration`). For most machines, a timer
669 the best results with a custom timer, it might be necessary to hard-code it