From ca13b3114786e8c563330aa22c19fd38abfe244d Mon Sep 17 00:00:00 2001 From: Ralf Jung <post@ralfj.de> Date: Thu, 21 Jun 2018 20:36:36 +0200 Subject: [PATCH] use /usr/bin/time to collect runtime and memory --- perf | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/perf b/perf index 6cd60e4..e1f17d4 100755 --- a/perf +++ b/perf @@ -3,6 +3,6 @@ set -e # Wrapper script to use perf as TIMECMD for the build. VFILE="${!#}" -perf stat -o "$VFILE.perf.tmp" -x ';' -e instructions,cycles -- "$@" -(echo "## $VFILE" && (cat "$VFILE.perf.tmp" | egrep -v '^(# .*)?$') && echo) > "$VFILE.perf" -rm "$VFILE.perf.tmp" +LC_ALL=C /usr/bin/time -o "$VFILE.time" -f "real: %e, user: %U, sys: %S, mem: %M kB" -- perf stat -o "$VFILE.counters" -x ';' -e instructions,cycles -- "$@" +(echo "## $VFILE" && (cat "$VFILE.counters" | egrep -v '^(# .*)?$') && cat "$VFILE.time" && echo) > "$VFILE.perf" +rm "$VFILE.counters" "$VFILE.time" -- GitLab