Skip to content

Instantly share code, notes, and snippets.

@zolotyh
Created May 29, 2018 15:16
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save zolotyh/9212f3efc645760bd7bcd653fc59256a to your computer and use it in GitHub Desktop.
Save zolotyh/9212f3efc645760bd7bcd653fc59256a to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
set -e
#pub upgrade --no-precompile
dart --observe --pause_isolates_on_exit tool/grind.dart atomic-build-runner &
#dart --optimization_counter_threshold=500 --worker_timeout_millis=500 --new_gen_ext_limit=4048 --old_gen_growth_rate=1000 tool/grind.dart serve &
pid=$!
# If this script is killed, kill the `dart'.
trap "kill $pid 2> /dev/null" EXIT
(>&2 echo "NUMBER,VIRTUAL_MEMORY (kb),REAL_MEMORY (kb),CPU,SWAP") 2> ./measures.csv
# While process is running...
COUNTER=1
while kill -0 $pid 2> /dev/null; do
VIRTUAL_MEMORY="$(ps -p $pid -o vsize=)";
REAL_MEMORY="$(ps -p $pid -o rss=)";
CPU="$(ps -p $pid -o %cpu=)";
SWAP="$(ps -p $pid -o nswap=)";
(>&2 echo $COUNTER","$VIRTUAL_MEMORY","$REAL_MEMORY","$CPU","$SWAP) 2>> ./measures.csv
COUNTER=$[$COUNTER +1]
sleep 1
done
# Disable the trap on a normal exit.
trap - EXIT
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment