Skip to content

Instantly share code, notes, and snippets.

@disassembler
Created August 23, 2018 13:00
Show Gist options
  • Save disassembler/225e64839c5b27ac258537a6494e1d96 to your computer and use it in GitHub Desktop.
Save disassembler/225e64839c5b27ac258537a6494e1d96 to your computer and use it in GitHub Desktop.
performance-metrics() {
thingname=$1
shift
if [ -n "${enablePhaseMetrics:-}" ]; then
TIMEFORMAT="time.$thingname.user %U
time.$thingname.system %S
time.$thingname.real %R"
exec {fd}<&2; time ( $@ 2>&$fd; ) 2>> ~/metrics; exec {fd}<&-
else
"$@"
fi
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment