Dump memory statistics. Will print a sample of all RSS memory samples added by calling :func:`sample_mem`, and in addition print used RSS memory after :func:`gc.collect`.
(samples=10, file=None)
| 81 | |
| 82 | |
| 83 | def memdump(samples=10, file=None): # pragma: no cover |
| 84 | """Dump memory statistics. |
| 85 | |
| 86 | Will print a sample of all RSS memory samples added by |
| 87 | calling :func:`sample_mem`, and in addition print |
| 88 | used RSS memory after :func:`gc.collect`. |
| 89 | """ |
| 90 | say = partial(print, file=file) |
| 91 | if ps() is None: |
| 92 | say('- rss: (psutil not installed).') |
| 93 | return |
| 94 | prev, after_collect = _memdump(samples) |
| 95 | if prev: |
| 96 | say('- rss (sample):') |
| 97 | for mem in prev: |
| 98 | say(f'- > {mem},') |
| 99 | say(f'- rss (end): {after_collect}.') |
| 100 | |
| 101 | |
| 102 | def sample(x, n, k=0): |
no test coverage detected