Skip to content
Snippets Groups Projects
Commit 7fedc047 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

get_own_cpu_usage() will now work on Windows

parent 47c9aff2
No related branches found
No related tags found
No related merge requests found
...@@ -3,4 +3,5 @@ ...@@ -3,4 +3,5 @@
* added DeferredValue * added DeferredValue
* satella.coding.Context are considered experimental * satella.coding.Context are considered experimental
* added a way to register an object to be cleaned up via MemoryPressureManager * added a way to register an object to be cleaned up via MemoryPressureManager
* fixed get_own_cpu_usage() to work on Windows
...@@ -10,12 +10,28 @@ from Satella solves that problem. ...@@ -10,12 +10,28 @@ from Satella solves that problem.
.. autofunction:: satella.instrumentation.memory.get_size .. autofunction:: satella.instrumentation.memory.get_size
.. warning:: Using these conditions will spawn a daemon thread to monitor the memory usage install_force_gc_collect
in the background. ------------------------
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 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: To define a severity level, use the following classes:
.. autoclass:: satella.instrumentation.memory.GlobalAbsoluteValue .. autoclass:: satella.instrumentation.memory.GlobalAbsoluteValue
...@@ -57,18 +73,3 @@ that level 1 is still in effect. You can register your handlers here: ...@@ -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 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 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`. 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
...@@ -19,7 +19,7 @@ DEFAULT_WINDOW_SECONDS = '10s' ...@@ -19,7 +19,7 @@ DEFAULT_WINDOW_SECONDS = '10s'
pCPUtimes = collections.namedtuple('pcputimes', pCPUtimes = collections.namedtuple('pcputimes',
['user', 'system', 'children_user', 'children_system', ['user', 'system', 'children_user', 'children_system',
'iowait']) 'iowait'], defaults=[0, 0, 0, 0, 0])
class _CPUProfileBuilderThread(SingleStartThread): class _CPUProfileBuilderThread(SingleStartThread):
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment