[pypy-commit] extradoc extradoc: add some tool to measure residual mem usage over time

Raemi noreply at buildbot.pypy.org
Mon May 26 15:50:34 CEST 2014


Author: Remi Meier <remi.meier at inf.ethz.ch>
Branch: extradoc
Changeset: r5266:f530e6b6abe8
Date: 2014-05-26 15:51 +0200
http://bitbucket.org/pypy/extradoc/changeset/f530e6b6abe8/

Log:	add some tool to measure residual mem usage over time

diff --git a/talk/dls2014/misc/measure_memusage.sh b/talk/dls2014/misc/measure_memusage.sh
new file mode 100755
--- /dev/null
+++ b/talk/dls2014/misc/measure_memusage.sh
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+# invoke like
+#    ./measure_memusage.sh command to execute
+# it uses 'top' and records its output in a tempfile (not deleted
+# afterwards). The interval for measurements is 1s. The RES/VIRT/SHR
+# should be in KiB.
+
+TMPFILE=$(tempfile)
+
+"$@" &
+PID=$!
+
+top -d1 -b -i -p $PID > $TMPFILE &
+MEMPID=$!
+
+wait $PID
+kill $MEMPID
+
+cat $TMPFILE | egrep "(PID)|(^\W*$PID)"
+echo "RESULTS in $TMPFILE"
+#pypy-c ~/pypy/benchmarks/multithread/multithread-richards.py 100 4 2>/dev/null & top -d1 -b -i -p $(pidof pypy-c)  > output


More information about the pypy-commit mailing list