Last active
November 4, 2016 14:42
-
-
Save nnethercote/10ec6918e02029e7609c9bb8d594b986 to your computer and use it in GitHub Desktop.
Bash functions for running DHAT and Massif on rustc-benchmarks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rustc-get-command | |
{ | |
local rust=$1 | |
local stage=$2 | |
local prefix=$3 | |
echo "Getting command" | |
local rustc=/home/njn/moz/$rust/x86_64-unknown-linux-gnu/$stage/bin/rustc | |
make clean > $prefix-make-clean-out 2>&1 | |
CARGO_OPTS='-v' RUSTC=$rustc make > $prefix-make1-out 2>&1 || return 1 | |
make touch > $prefix-make-touch-out 2>&1 || return 1 | |
CARGO_OPTS='-v' RUSTC=$rustc make > $prefix-make2-out 2>&1 || return 1 | |
grep "Running" $prefix-make2-out | sed 's/^ *Running `\(.*\)`/\1/' > $prefix-grep-out | |
# This weirdness is to handle backslashes for inflate-0.1.0, sigh. | |
cat $prefix-grep-out | sed 's/\\//g' > $prefix-grep-out-2 | |
mv -f $prefix-grep-out-2 $prefix-grep-out | |
} | |
function rustc-dhat | |
{ | |
local rust=$1 | |
local stage=$2 | |
local name=$3 | |
if [ -z "$name" ] ; then | |
echo "usage: $FUNCNAME <rustN> <stageN> <out-name-suffix>" | |
return 1 | |
fi | |
rustc-get-command $rust $stage "dh" | |
# The OUT_DIR is a hack required for html5ever, sigh. | |
echo "Running under DHAT" | |
OUT_DIR=../../../target/debug/build/html5ever-1d059a2a3fb684fc/out/ \ | |
MALLOC_CONF=quarantine:0 time /home/njn/grind/ws3/vg-in-place \ | |
--tool=exp-dhat --show-top-n=1000 --num-callers=4 \ | |
--sort-by=tot-blocks-allocd \ | |
`cat dh-grep-out` 2> dhat-$name | |
#rustfilt dhat-$name | |
echo "Annotations are in dhat-$name" | |
} | |
function rustc-massif | |
{ | |
local rust=$1 | |
local stage=$2 | |
local name=$3 | |
if [ -z "$name" ] ; then | |
echo "usage: $FUNCNAME <rustN> <stageN> <out-name-suffix>" | |
return 1 | |
fi | |
rustc-get-command $rust $stage "ms" | |
# The OUT_DIR is a hack required for html5ever, sigh. | |
echo "Running under Massif" | |
OUT_DIR=../../../target/debug/build/html5ever-1d059a2a3fb684fc/out/ \ | |
MALLOC_CONF=quarantine:0 time /home/njn/grind/ws3/vg-in-place \ | |
--tool=massif --heap-admin=0 --threshold=0.5 \ | |
--massif-out-file=msout-$name \ | |
`cat ms-grep-out` | |
#rustfilt msout-$name | |
ms_print --threshold=0 msout-$name > msann-$name | |
echo "Annotations are in msann-$name" | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment