diff --git a/CHANGELOG.md b/CHANGELOG.md index c3a0f665bdf4b003f59f166329f10b00aa01efee..e4201c01145d7dccd5a6b8adb23469c0b252252c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,4 +3,5 @@ * added DeferredValue * satella.coding.Context are considered experimental * added a way to register an object to be cleaned up via MemoryPressureManager +* fixed get_own_cpu_usage() to work on Windows diff --git a/docs/instrumentation/memory.rst b/docs/instrumentation/memory.rst index 589ab7110ddb56ff9f72b258f0695079279a1cff..167fb8841c0f46e1c957ff3a01d7c8c883cda3bc 100644 --- a/docs/instrumentation/memory.rst +++ b/docs/instrumentation/memory.rst @@ -10,12 +10,28 @@ from Satella solves that problem. .. autofunction:: satella.instrumentation.memory.get_size -.. warning:: Using these conditions will spawn a daemon thread to monitor the memory usage - in the background. +install_force_gc_collect +------------------------ + +If you want, you can install a GC handler that will +force a complete GC collection upon entering given severity level. + +.. autofunction:: satella.instrumentation.memory.install_force_gc_collect + +Dumping memory information +-------------------------- + +.. autofunction:: satella.instrumentation.memory.dump_memory_on + +.. autofunction:: satella.instrumentation.memory.install_dump_memory_on + Defining severity levels ------------------------ +.. warning:: Using following routines will spawn a daemon thread to monitor the memory usage + in the background. + To define a severity level, use the following classes: .. autoclass:: satella.instrumentation.memory.GlobalAbsoluteValue @@ -57,18 +73,3 @@ that level 1 is still in effect. You can register your handlers here: Note that you can also register objects to have their methods called on entering a memory severity level, if these objects have a way to to for example drop some data onto disk and decrease memory usage via :meth:`~satella.instrumentation.memory.MemoryPressureManager.cleanup_on_entered`. - -install_force_gc_collect ------------------------- - -If you want, you can install a GC handler that will -force a complete GC collection upon entering given severity level. - -.. autofunction:: satella.instrumentation.memory.install_force_gc_collect - -Dumping memory information --------------------------- - -.. autofunction:: satella.instrumentation.memory.dump_memory_on - -.. autofunction:: satella.instrumentation.memory.install_dump_memory_on diff --git a/satella/instrumentation/cpu_time/collector.py b/satella/instrumentation/cpu_time/collector.py index c041ab503c3f47a6777b456d1fb2ff006d711ccf..95d244c63047f75fe8ec21db78ed33551a210045 100644 --- a/satella/instrumentation/cpu_time/collector.py +++ b/satella/instrumentation/cpu_time/collector.py @@ -19,7 +19,7 @@ DEFAULT_WINDOW_SECONDS = '10s' pCPUtimes = collections.namedtuple('pcputimes', ['user', 'system', 'children_user', 'children_system', - 'iowait']) + 'iowait'], defaults=[0, 0, 0, 0, 0]) class _CPUProfileBuilderThread(SingleStartThread):