Python Glossary Русский

Python 3.3+osterm

os.times_result

os — process

The result type of os.times(): a named tuple (user/system/children_*/elapsed).

Syntax

os.times_result(...)

children_user and children_system count only children that have been reaped with wait: running or abandoned children are not included. elapsed counts from an arbitrary point in the past, so only the difference between two readings is meaningful. Like other os results it also behaves as a tuple.

Examples

import os
tr = os.times_result((1.0, 2.0, 3.0, 4.0, 5.0))
print(tr.elapsed)   # → 5.0
print(tr.user, tr.system)   # → 1.0 2.0
print(tuple(tr))   # → (1.0, 2.0, 3.0, 4.0, 5.0)
print(isinstance(os.times(), os.times_result))   # → True: именно этот тип возвращает os.times()
os.times_result((1.0, 2.0))   # → TypeError: конструктору нужна последовательность ровно из 5 элементов

See also

Open in the full glossarydocs.python.orgReport an inaccuracy