[Python-checkins] r86493 - in python/branches/py3k: Doc/library/resource.rst Lib/test/test_resource.py Misc/NEWS Modules/resource.c
antoine.pitrou
python-checkins at python.org
Wed Nov 17 17:19:35 CET 2010
Author: antoine.pitrou
Date: Wed Nov 17 17:19:35 2010
New Revision: 86493
Log:
Issue #10440: Support RUSAGE_THREAD as a constant in the resource module.
Patch by Robert Collins.
Modified:
python/branches/py3k/Doc/library/resource.rst
python/branches/py3k/Lib/test/test_resource.py
python/branches/py3k/Misc/NEWS
python/branches/py3k/Modules/resource.c
Modified: python/branches/py3k/Doc/library/resource.rst
==============================================================================
--- python/branches/py3k/Doc/library/resource.rst (original)
+++ python/branches/py3k/Doc/library/resource.rst Wed Nov 17 17:19:35 2010
@@ -217,14 +217,14 @@
.. data:: RUSAGE_SELF
- :const:`RUSAGE_SELF` should be used to request information pertaining only to
- the process itself.
+ Pass to :func:`getrusage` to request resources consumed by the calling
+ process, which is the sum of resources used by all threads in the process.
.. data:: RUSAGE_CHILDREN
- Pass to :func:`getrusage` to request resource information for child processes of
- the calling process.
+ Pass to :func:`getrusage` to request resources consumed by child processes
+ of the calling process which have been terminated and waited for.
.. data:: RUSAGE_BOTH
@@ -232,3 +232,10 @@
Pass to :func:`getrusage` to request resources consumed by both the current
process and child processes. May not be available on all systems.
+
+.. data:: RUSAGE_THREAD
+
+ Pass to :func:`getrusage` to request resources consumed by the current
+ thread. May not be available on all systems.
+
+ .. versionadded:: 3.2
Modified: python/branches/py3k/Lib/test/test_resource.py
==============================================================================
--- python/branches/py3k/Lib/test/test_resource.py (original)
+++ python/branches/py3k/Lib/test/test_resource.py Wed Nov 17 17:19:35 2010
@@ -102,6 +102,10 @@
usageboth = resource.getrusage(resource.RUSAGE_BOTH)
except (ValueError, AttributeError):
pass
+ try:
+ usage_thread = resource.getrusage(resource.RUSAGE_THREAD)
+ except (ValueError, AttributeError):
+ pass
def test_main(verbose=None):
support.run_unittest(ResourceTest)
Modified: python/branches/py3k/Misc/NEWS
==============================================================================
--- python/branches/py3k/Misc/NEWS (original)
+++ python/branches/py3k/Misc/NEWS Wed Nov 17 17:19:35 2010
@@ -13,6 +13,9 @@
Library
-------
+- Issue #10440: Support RUSAGE_THREAD as a constant in the resource module.
+ Patch by Robert Collins.
+
- Issue #10429: IMAP.starttls() stored the capabilities as bytes objects,
rather than strings.
Modified: python/branches/py3k/Modules/resource.c
==============================================================================
--- python/branches/py3k/Modules/resource.c (original)
+++ python/branches/py3k/Modules/resource.c Wed Nov 17 17:19:35 2010
@@ -325,6 +325,10 @@
PyModule_AddIntConstant(m, "RUSAGE_BOTH", RUSAGE_BOTH);
#endif
+#ifdef RUSAGE_THREAD
+ PyModule_AddIntConstant(m, "RUSAGE_THREAD", RUSAGE_THREAD);
+#endif
+
#if defined(HAVE_LONG_LONG)
if (sizeof(RLIM_INFINITY) > sizeof(long)) {
v = PyLong_FromLongLong((PY_LONG_LONG) RLIM_INFINITY);
More information about the Python-checkins
mailing list