PEP 454: remove Snapshot.timestamp attribute

This commit is contained in:
Victor Stinner 2013-11-08 18:06:37 +01:00
parent 4841d22de4
commit c97d838774
1 changed files with 23 additions and 28 deletions

View File

@ -153,7 +153,7 @@ Main functions
The function uninstalls hooks on Python memory allocators, so the
overhead of the module becomes null.
Call ``get_traces()`` or ``take_snapshot()`` function to get traces
Call ``take_snapshot()`` function to take a snapshot of traces
before clearing them.
See also ``start()`` and ``is_tracing()`` functions.
@ -168,8 +168,8 @@ Main functions
``tracemalloc`` module started to trace memory allocations nor
memory blocks ignored by filters (see ``get_filters()``).
Tracebacks of traces are limited to ``traceback_limit`` frames. Use
``set_traceback_limit()`` to store more frames.
Tracebacks of traces are limited to ``get_traceback_limit()``
frames. Use ``set_traceback_limit()`` to store more frames.
The ``tracemalloc`` module must be tracing memory allocations to
take a snapshot, see the the ``start()`` function.
@ -214,14 +214,14 @@ allocation occurred. See the ``Trace`` class.
function to measure the overhead and the ``add_filter()`` function
to select which memory allocations are traced.
If the limit is set to ``0`` frame, the traceback ``(('<unknown>',
0),)`` will be used for all traces.
If the limit is set to ``0`` frame, a traceback with a frame will be
used for all traces: filename ``'<unknown>'`` at line number ``0``.
Use the ``get_traceback_limit()`` function to get the current limit.
The ``PYTHONTRACEMALLOC`` environment variable and the ``-X``
``tracemalloc=NFRAME`` command line option can be used to set a
limit at startup.
The ``PYTHONTRACEMALLOC`` environment variable
(``PYTHONTRACEMALLOC=NFRAME``) and the ``-X`` ``tracemalloc=NFRAME``
command line option can be used to set the limit at startup.
Filter functions
@ -306,7 +306,7 @@ Filter
``filename_pattern`` attribute:
Filename pattern (``str``) of the filter.
Filename pattern of the filter (``str``).
``all_frames`` attribute:
@ -315,7 +315,8 @@ Filter
checked.
This attribute is ignored if the traceback limit is less than ``2``.
See the ``get_traceback_limit()`` function.
See the ``get_traceback_limit()`` function and
``Snapshot.traceback_limit`` attribute.
Frame
@ -343,12 +344,12 @@ Snapshot
Snapshot of traces of memory blocks allocated by Python.
The ``take_snapshot()`` function create a snapshot instance.
The ``take_snapshot()`` function creates a snapshot instance.
``apply_filters(filters)`` method:
Create a new ``Snapshot`` instance with the filtered ``traces``,
*filters* is a list of ``Filter`` instances.
Create a new ``Snapshot`` instance with the filtered ``traces``
sequence, *filters* is a list of ``Filter`` instances.
If *filters* is an empty list, return a new ``Snapshot`` instance
with a copy of the traces.
@ -356,9 +357,8 @@ Snapshot
``compare_to(old_snapshot: Snapshot, group_by: str, cumulative: bool=False)`` method:
Compute the differences with an old snapshot *old_snapshot*. Get
statistics as a sorted list of ``StatisticDiff`` instances, grouped
by *group_by*.
Compute the differences with an old snapshot. Get statistics as a
sorted list of ``StatisticDiff`` instances grouped by *group_by*.
See the ``statistics()`` method for *group_by* and *cumulative*
parameters.
@ -385,7 +385,7 @@ Snapshot
``statistics(group_by: str, cumulative: bool=False)`` method:
Get statistics as a sorted list of ``Statistic`` instances, grouped
Get statistics as a sorted list of ``Statistic`` instances grouped
by *group_by*:
===================== ========================
@ -398,9 +398,9 @@ Snapshot
If *cumulative* is ``True``, cumulate size and count of memory
blocks of all frames of the traceback of a trace, not only the most
recent frame. The cumulative mode can only be used with key types
``'filename'`` and ``'lineno'`` with ``traceback_limit`` greater
than ``1``.
recent frame. The cumulative mode can only be used with *group_by*
equals to ``'filename'`` and ``'lineno'`` and ``traceback_limit``
greater than ``1``.
The result is sorted from the biggest to the smallest by:
``Statistic.size``, ``Statistic.count`` and then by
@ -409,8 +409,8 @@ Snapshot
``traceback_limit`` attribute:
Maximum number of frames stored in the traceback of ``traces``: see
the ``get_traceback_limit()`` function.
Maximum number of frames stored in the traceback of ``traces``:
result of the ``get_traceback_limit()`` when the snapshot was taken.
``traces`` attribute:
@ -420,11 +420,6 @@ Snapshot
The sequence has an undefined order. Use the
``Snapshot.statistics()`` method to get a sorted list of statistics.
``timestamp`` attribute:
Creation date and time of the snapshot, ``datetime.datetime``
instance.
Statistic
---------
@ -525,7 +520,7 @@ Traceback
module failed to get a frame, the filename ``"<unknown>"`` and the
line number ``0`` are used. If it failed to get the traceback or if
the traceback limit is ``0``, the traceback only contains a frame:
filename ``'<unknown>'`` and line number ``0``.
filename ``'<unknown>'`` at line number ``0``.
When a snapshot is taken, tracebacks of traces are limited to
``get_traceback_limit()`` frames. See the ``take_snapshot()``