Lines Matching +full:sort +full:- +full:object
9 --------------
11 .. _profiler-introduction:
29 reasonable overhead that makes it suitable for profiling long-running
44 but not for C-level functions, and so the C code would seem faster than any
48 .. _profile-instant:
74 1 0.000 0.000 0.002 0.002 {built-in method builtins.exec}
86 far right column was used to sort the output. The column headings include:
93 calls to sub-functions)
127 python -m cProfile [-o output_file] [-s sort_order] (-m module | myscript.py)
129 ``-o`` writes the profile results to a file instead of to stdout
131 ``-s`` specifies one of the :func:`~pstats.Stats.sort_stats` sort values to sort
132 the output by. This only applies when ``-o`` is not supplied.
134 ``-m`` specifies that a module is being profiled instead of a script.
137 Added the ``-m`` option to :mod:`cProfile`.
140 Added the ``-m`` option to :mod:`profile`.
148 p.strip_dirs().sort_stats(-1).print_stats()
154 might try the following sort calls::
159 The first call will actually sort the list by function name, and the second call
174 to sort according to time spent within each function, and then print the
181 This will sort all the statistics by file name, and then print out statistics
190 lines containing ``init`` are maintained, and that sub-sub-list is printed.
206 reading and examining profile dumps. It has a simple line-oriented interface
219 .. function:: run(command, filename=None, sort=-1)
228 instance and prints a simple profiling report. If the sort value is specified,
232 .. function:: runctx(command, globals, locals, filename=None, sort=-1)
295 .. method:: print_stats(sort=-1)
297 Create a :class:`~pstats.Stats` object based on the current
322 .. _profile-stats:
330 :synopsis: Statistics object for use with the profiler.
334 This class constructor creates an instance of a "statistics object" from a
346 existing :class:`~pstats.Stats` object, the :meth:`~pstats.Stats.add` method
350 or :class:`profile.Profile` object can be used as the profile data source.
359 the object, and the stripped information is lost. After performing a
360 strip operation, the object is considered to have its entries in a
361 "random" order, as it was just after object initialization and loading.
371 information into the current profiling object. Its arguments should refer
380 Save the data loaded into the :class:`Stats` object to a file named
388 This method modifies the :class:`Stats` object by sorting it according to
390 enum identifying the basis of a sort (example: ``'time'``, ``'name'``,
397 them. For example, ``sort_stats(SortKey.NAME, SortKey.FILE)`` will sort
406 +------------------+---------------------+----------------------+
410 +------------------+---------------------+----------------------+
412 +------------------+---------------------+----------------------+
414 +------------------+---------------------+----------------------+
416 +------------------+---------------------+----------------------+
418 +------------------+---------------------+----------------------+
420 +------------------+---------------------+----------------------+
422 +------------------+---------------------+----------------------+
424 +------------------+---------------------+----------------------+
426 +------------------+---------------------+----------------------+
428 +------------------+---------------------+----------------------+
430 +------------------+---------------------+----------------------+
432 +------------------+---------------------+----------------------+
434 +------------------+---------------------+----------------------+
436 +------------------+---------------------+----------------------+
442 sort of the name as printed, which means that the embedded line numbers
449 For backward-compatibility reasons, the numeric arguments ``-1``, ``0``,
452 style format (numeric) is used, only one sort key (the numeric key) will
463 basic list within the object. Note that by default ascending vs
464 descending order is properly selected based on the sort key of choice.
476 :meth:`~pstats.Stats.sort_stats` operation done on the object (subject to
512 second non-parenthesized number repeats the cumulative time spent in the
540 .. _deterministic-profiling:
564 and to identify possible inline-expansion points (high call counts). Internal
573 .. _profile-limitations:
596 The problem is more important with :mod:`profile` than with the lower-overhead
602 probability work against you :-). ) Do *not* be alarmed by negative numbers in
607 .. _profile-calibration:
616 :ref:`profile-limitations`). ::
627 the timer, the magical number is about 4.04e-6.
629 The object of this exercise is to get a fairly consistent result. If your
650 .. _profile-timers:
656 of wall-clock time or elapsed process time), pass the timing function you want
673 that you choose (see :ref:`profile-calibration`). For most machines, a timer
692 the best results with a custom timer, it might be necessary to hard-code it
696 precise measurements of process or wall-clock time. For example, see