source:
people/peter.buschman/backup_monitoring/debug/_debug.py@
979
| Last change on this file since 979 was 976, checked in by , on Dec 6, 2011 at 10:19:33 AM | |
|---|---|
| File size: 349 bytes | |
| Line | |
|---|---|
| 1 | from guppy import * |
| 2 | |
| 3 | ## |
| 4 | ## heapsize() - Return size of heap (memory used by objects) in MB |
| 5 | ## |
| 6 | def heapsize(format='string'): |
| 7 | |
| 8 | heapsize = hpy().heap().size / 1024.0 / 1024.0 |
| 9 | |
| 10 | if format == 'string': |
| 11 | return '%.2f MB' % (heapsize) |
| 12 | elif format == 'int': |
| 13 | return int(heapsize) |
| 14 | else: |
| 15 | return heapsize |
| 16 |
Note:
See TracBrowser
for help on using the repository browser.
