Skip to content

Instantly share code, notes, and snippets.

@cogumbreiro
Last active October 14, 2016 00:12
Show Gist options
  • Save cogumbreiro/90d58d41e648cfce45005509500e2b94 to your computer and use it in GitHub Desktop.
Save cogumbreiro/90d58d41e648cfce45005509500e2b94 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
FREQUENCY=20ms
"$@" &
jid=$!
trap cleanup INT
function cleanup() {
kill $jid
}
(jstat -gc $jid $FREQUENCY > jstat.log || exit -1)
wait $jid
exit $?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment