bpo-35511: Trivial docs updates for profile and resource library modules. (GH-11124)

polish documentation for profile and resource modules
This commit is contained in:
Beomsoo Kim 2018-12-17 04:34:08 +09:00 committed by Andrew Svetlov
parent 640ed520dd
commit b912f9342e
3 changed files with 59 additions and 42 deletions

View file

@ -265,8 +265,8 @@ functions:
ps.print_stats()
print(s.getvalue())
The :class:`Profile` class can also be used as a context manager (see
:ref:`typecontextmanager`)::
The :class:`Profile` class can also be used as a context manager (supported
only in :mod:`cProfile` module. see :ref:`typecontextmanager`)::
import cProfile
@ -280,11 +280,11 @@ functions:
.. method:: enable()
Start collecting profiling data.
Start collecting profiling data. Only in :mod:`cProfile`.
.. method:: disable()
Stop collecting profiling data.
Stop collecting profiling data. Only in :mod:`cProfile`.
.. method:: create_stats()
@ -540,9 +540,9 @@ less overhead (as the code does not need to be instrumented), but provides only
relative indications of where time is being spent.
In Python, since there is an interpreter active during execution, the presence
of instrumented code is not required to do deterministic profiling. Python
automatically provides a :dfn:`hook` (optional callback) for each event. In
addition, the interpreted nature of Python tends to add so much overhead to
of instrumented code is not required in order to do deterministic profiling.
Python automatically provides a :dfn:`hook` (optional callback) for each event.
In addition, the interpreted nature of Python tends to add so much overhead to
execution, that deterministic profiling tends to only add small processing
overhead in typical applications. The result is that deterministic profiling is
not that expensive, yet provides extensive run time statistics about the