Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 771cf89

Browse files
committed
Merge 3.5
2 parents acc2f74 + 440d703 commit 771cf89

2 files changed

Lines changed: 14 additions & 13 deletions

File tree

Doc/library/tracemalloc.rst

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -66,7 +66,7 @@ Example of output of the Python test suite::
6666
<string>:5: size=49.7 KiB, count=148, average=344 B
6767
/usr/lib/python3.4/sysconfig.py:411: size=48.0 KiB, count=1, average=48.0 KiB
6868

69-
We can see that Python loaded ``4.8 MiB`` data (bytecode and constants) from
69+
We can see that Python loaded ``4855 KiB`` data (bytecode and constants) from
7070
modules and that the :mod:`collections` module allocated ``244 KiB`` to build
7171
:class:`~collections.namedtuple` types.
7272

@@ -106,8 +106,8 @@ Example of output before/after running some tests of the Python test suite::
106106
/usr/lib/python3.4/urllib/parse.py:476: size=71.8 KiB (+71.8 KiB), count=969 (+969), average=76 B
107107
/usr/lib/python3.4/contextlib.py:38: size=67.2 KiB (+67.2 KiB), count=126 (+126), average=546 B
108108

109-
We can see that Python has loaded ``8.2 MiB`` of module data (bytecode and
110-
constants), and that this is ``4.4 MiB`` more than had been loaded before the
109+
We can see that Python has loaded ``8173 KiB`` of module data (bytecode and
110+
constants), and that this is ``4428 KiB`` more than had been loaded before the
111111
tests, when the previous snapshot was taken. Similarly, the :mod:`linecache`
112112
module has cached ``940 KiB`` of Python source code to format tracebacks, all
113113
of it since the previous snapshot.
@@ -176,7 +176,7 @@ Example of output of the Python test suite (traceback limited to 25 frames)::
176176
"__main__", fname, loader, pkg_name)
177177

178178
We can see that the most memory was allocated in the :mod:`importlib` module to
179-
load data (bytecode and constants) from modules: ``870 KiB``. The traceback is
179+
load data (bytecode and constants) from modules: ``870.1 KiB``. The traceback is
180180
where the :mod:`importlib` loaded data most recently: on the ``import pdb``
181181
line of the :mod:`doctest` module. The traceback may change if a new module is
182182
loaded.
@@ -192,12 +192,12 @@ ignoring ``<frozen importlib._bootstrap>`` and ``<unknown>`` files::
192192
import os
193193
import tracemalloc
194194

195-
def display_top(snapshot, group_by='lineno', limit=10):
195+
def display_top(snapshot, key_type='lineno', limit=10):
196196
snapshot = snapshot.filter_traces((
197197
tracemalloc.Filter(False, "<frozen importlib._bootstrap>"),
198198
tracemalloc.Filter(False, "<unknown>"),
199199
))
200-
top_stats = snapshot.statistics(group_by)
200+
top_stats = snapshot.statistics(key_type)
201201

202202
print("Top %s lines" % limit)
203203
for index, stat in enumerate(top_stats[:limit], 1):
@@ -468,12 +468,12 @@ Snapshot
468468

469469
The :func:`take_snapshot` function creates a snapshot instance.
470470

471-
.. method:: compare_to(old_snapshot: Snapshot, group_by: str, cumulative: bool=False)
471+
.. method:: compare_to(old_snapshot: Snapshot, key_type: str, cumulative: bool=False)
472472

473473
Compute the differences with an old snapshot. Get statistics as a sorted
474-
list of :class:`StatisticDiff` instances grouped by *group_by*.
474+
list of :class:`StatisticDiff` instances grouped by *key_type*.
475475

476-
See the :meth:`Snapshot.statistics` method for *group_by* and *cumulative*
476+
See the :meth:`Snapshot.statistics` method for *key_type* and *cumulative*
477477
parameters.
478478

479479
The result is sorted from the biggest to the smallest by: absolute value
@@ -511,13 +511,13 @@ Snapshot
511511
See also :meth:`dump`.
512512

513513

514-
.. method:: statistics(group_by: str, cumulative: bool=False)
514+
.. method:: statistics(key_type: str, cumulative: bool=False)
515515

516516
Get statistics as a sorted list of :class:`Statistic` instances grouped
517-
by *group_by*:
517+
by *key_type*:
518518

519519
===================== ========================
520-
group_by description
520+
key_type description
521521
===================== ========================
522522
``'filename'`` filename
523523
``'lineno'`` filename and line number
@@ -526,7 +526,7 @@ Snapshot
526526

527527
If *cumulative* is ``True``, cumulate size and count of memory blocks of
528528
all frames of the traceback of a trace, not only the most recent frame.
529-
The cumulative mode can only be used with *group_by* equals to
529+
The cumulative mode can only be used with *key_type* equals to
530530
``'filename'`` and ``'lineno'``.
531531

532532
The result is sorted from the biggest to the smallest by:

Misc/ACKS

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1141,6 +1141,7 @@ Alecsandru Patrascu
11411141
Randy Pausch
11421142
Samuele Pedroni
11431143
Justin Peel
1144+
Loic Pefferkorn
11441145
Marcel van der Peijl
11451146
Berker Peksag
11461147
Andreas Pelme

0 commit comments

Comments
 (0)