On this page
resource.getrusage
Prev: resource.getrlimit | Up: resource | Next: resource.setrlimit
Rel: resource.error, resource.getpagesize, resource.getrlimit, resource.setrlimit
Ref: docs.python.org — resource.getrusage
Tags: #public #python3 #stdlib #resource
Import
import resource
from resource import getrusage
Signature & Overview
resource.getrusage(who, /)
resource.getrusage() function.
Usage
import resource
u = resource.getrusage(resource.RUSAGE_SELF)
assert u.ru_utime >= 0 and u.ru_maxrss > 0
Gotchas
ru_maxrssunits differ by OS: bytes on macOS vs. kilobytes on Linux!
REPL Inspect
from resource import getrusage
help(getrusage)
Linked from
Related notes
- tuts/python3/stdlib_module/resource/error Linked here; links to this page; shared tags: #resource, #stdlib
- tuts/python3/stdlib_module/resource/getpagesize Linked here; links to this page; shared tags: #resource, #stdlib
- tuts/python3/stdlib_module/resource/getrlimit Linked here; links to this page; shared tags: #resource, #stdlib
- tuts/python3/stdlib_module/resource/setrlimit Linked here; links to this page; shared tags: #resource, #stdlib
- tuts/python3/stdlib_module/resource Linked here; links to this page; shared tags: #stdlib
- tuts/python3/stdlib_module/resource/struct_rusage links to this page; shared tags: #resource, #stdlib
- tuts/c/stdlib shared tags: #stdlib
- tuts/c/stdlib/assert shared tags: #stdlib
- tuts/c/stdlib/assert/assert shared tags: #stdlib
- tuts/c/stdlib/assert/static_assert shared tags: #stdlib