Skip to content
This repository has been archived by the owner on Jul 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #924 from mozilla-services/release/1.32
Browse files Browse the repository at this point in the history
chore: tag 1.32.1
  • Loading branch information
bbangert authored Jun 19, 2017
2 parents fe6b5f0 + 474c84d commit 2294cf7
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 5 deletions.
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
<a name="1.32.1"></a>
## 1.32.1 (2017-06-19)


#### Features

* dump pmap -XX/X if available ([fa792a6a](https://github.com/mozilla-services/autopush/commit/fa792a6a9536263bcbac8aa29da147a987ffe854))



<a name="1.32.0"></a>
## 1.32.0 (2017-06-15)

Expand Down
2 changes: 1 addition & 1 deletion autopush/__init__.py
Original file line number Diff line number Diff line change
@@ -1 +1 @@
__version__ = '1.32.0' # pragma: nocover
__version__ = '1.32.1' # pragma: nocover
21 changes: 18 additions & 3 deletions autopush/memusage.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,29 @@ def trap_err(func, *args, **kwargs):
buf.writelines([repr(rusage), '\n\n'])
trap_err(objgraph.show_most_common_types, limit=0, file=buf)
buf.write('\n\n')
pmap = trap_err(subprocess.check_output, ['pmap', '-x', str(os.getpid())],
stderr=subprocess.STDOUT)
buf.writelines([pmap, '\n\n'])
trap_err(pmap_extended, buf)
trap_err(dump_rpy_heap, buf)
trap_err(get_stats_asmmemmgr, buf)
return buf.getvalue()


def pmap_extended(stream):
"""Write pmap (w/ the most extended stats supported) to stream"""
pid = str(os.getpid())
# -XX/-X are recent linux only
ex_args = ['XX', 'X', 'x']
while True:
cmd = ['pmap', '-' + ex_args.pop(0), pid]
try:
pmap = subprocess.check_output(cmd, stderr=subprocess.STDOUT)
except subprocess.CalledProcessError: # pragma: nocover
if not ex_args:
raise
else:
stream.writelines([' '.join(cmd[:2]), '\n', pmap, '\n\n'])
break


def dump_rpy_heap(stream): # pragma: nocover
"""Write PyPy's gcdump to the specified stream"""
if not hasattr(gc, '_dump_rpy_heap'):
Expand Down
2 changes: 1 addition & 1 deletion autopush/tests/test_integration.py
Original file line number Diff line number Diff line change
Expand Up @@ -2179,7 +2179,7 @@ def test_memusage(self):
ok_('rusage' in body)
ok_('Logger' in body)
if find_executable('pmap'):
ok_('RSS' in body) # pmap -x output
ok_('RSS' in body or 'Rss' in body) # pmap -x or -XX/X output
if hasattr(sys, 'pypy_version_info'): # pragma: nocover
ok_('size: ' in body)
ok_('rpy_unicode' in body)
Expand Down

0 comments on commit 2294cf7

Please sign in to comment.