| 1 |
==================================== |
| 2 |
``celery.utils.debug`` |
| 3 |
==================================== |
| 4 |
|
| 5 |
.. contents:: |
| 6 |
:local: |
| 7 |
|
| 8 |
Sampling Memory Usage |
| 9 |
===================== |
| 10 |
|
| 11 |
This module can be used to diagnose and sample the memory usage |
| 12 |
used by parts of your application. |
| 13 |
|
| 14 |
For example, to sample the memory usage of calling tasks you can do this: |
| 15 |
|
| 16 |
.. code-block:: python |
| 17 |
|
| 18 |
|
| 19 |
from celery.utils.debug import sample_mem, memdump |
| 20 |
|
| 21 |
from tasks import add |
| 22 |
|
| 23 |
|
| 24 |
try: |
| 25 |
for i in range(100): |
| 26 |
for j in range(100): |
| 27 |
add.delay(i, j) |
| 28 |
sample_mem() |
| 29 |
finally: |
| 30 |
memdump() |
| 31 |
|
| 32 |
|
| 33 |
API Reference |
| 34 |
============= |
| 35 |
|
| 36 |
.. currentmodule:: celery.utils.debug |
| 37 |
|
| 38 |
.. automodule:: celery.utils.debug |
| 39 |
|
| 40 |
.. autofunction:: sample_mem |
| 41 |
|
| 42 |
.. autofunction:: memdump |
| 43 |
|
| 44 |
.. autofunction:: sample |
| 45 |
|
| 46 |
.. autofunction:: mem_rss |
| 47 |
|
| 48 |
.. autofunction:: ps |