Index: tools/eval_gc_time.sh |
diff --git a/tools/eval_gc_time.sh b/tools/eval_gc_time.sh |
index 23f7a4f369717606dcef2287e68b452223b56d0e..ceb4db54cb4606796c83b8a8983169526f56c9ac 100755 |
--- a/tools/eval_gc_time.sh |
+++ b/tools/eval_gc_time.sh |
@@ -7,47 +7,73 @@ |
# Convenience Script used to rank GC NVP output. |
print_usage_and_die() { |
- echo "Usage: $0 RANK SORT [LOGFILE]" |
+ echo "Usage: $0 [OPTIONS]" |
echo "" |
- echo "Arguments:" |
- echo " RANK: old-gen-rank | new-gen-rank" |
- echo " SORT: max | avg" |
- echo " LOGFILE: the file to process. will default to /dev/stdin" |
+ echo "OPTIONS" |
+ echo " -r|--rank new-gen-rank|old-gen-rank GC mode to profile" |
+ echo " (default: old-gen-rank)" |
+ echo " -s|--sort avg|max sorting mode (default: max)" |
+ echo " -t|--top-level include top-level categories" |
+ echo " -c|--csv provide csv output" |
+ echo " -f|--file FILE profile input in a file" |
+ echo " (default: stdin)" |
exit 1 |
} |
-if [[ $# -lt 2 || $# -gt 3 ]]; then |
- print_usage_and_die |
-fi |
- |
-case $1 in |
- new-gen-rank|old-gen-rank) |
- OP=$1 |
- ;; |
- *) |
- print_usage_and_die |
-esac |
+OP=old-gen-rank |
+RANK_MODE=max |
+TOP_LEVEL=no |
+CSV="" |
+LOGFILE=/dev/stdin |
-case $2 in |
- max|avg) |
- RANK_MODE=$2 |
- ;; |
- *) |
- print_usage_and_die |
-esac |
+while [[ $# -ge 1 ]] |
+do |
+ key="$1" |
+ case $key in |
+ -r|--rank) |
+ case $2 in |
+ new-gen-rank|old-gen-rank) |
+ OP="$2" |
+ ;; |
+ *) |
+ print_usage_and_die |
+ esac |
+ shift |
+ ;; |
+ -s|--sort) |
+ case $2 in |
+ max|avg) |
+ RANK_MODE=$2 |
+ ;; |
+ *) |
+ print_usage_and_die |
+ esac |
+ shift |
+ ;; |
+ -t|--top-level) |
+ TOP_LEVEL=yes |
+ ;; |
+ -c|--csv) |
+ CSV=" --csv " |
+ ;; |
+ -f|--file) |
+ LOGFILE=$2 |
+ shift |
+ ;; |
+ *) |
+ break |
+ ;; |
+ esac |
+ shift |
+done |
-if [ $# -eq 3 ]; then |
- LOGFILE=$3 |
-else |
- LOGFILE=/dev/stdin |
+if [[ $# -ne 0 ]]; then |
+ echo "Unknown option(s): $@" |
+ echo "" |
+ print_usage_and_die |
fi |
-GENERAL_INTERESTING_KEYS="\ |
- pause \ |
-" |
- |
INTERESTING_NEW_GEN_KEYS="\ |
- ${GENERAL_INTERESTING_KEYS} \ |
scavenge \ |
weak \ |
roots \ |
@@ -58,8 +84,6 @@ INTERESTING_NEW_GEN_KEYS="\ |
" |
INTERESTING_OLD_GEN_KEYS="\ |
- ${GENERAL_INTERESTING_KEYS} \ |
- clear \ |
clear.code_flush \ |
clear.dependent_code \ |
clear.global_handles \ |
@@ -70,8 +94,6 @@ INTERESTING_OLD_GEN_KEYS="\ |
clear.weak_cells \ |
clear.weak_collections \ |
clear.weak_lists \ |
- finish \ |
- evacuate \ |
evacuate.candidates \ |
evacuate.clean_up \ |
evacuate.copy \ |
@@ -85,7 +107,6 @@ INTERESTING_OLD_GEN_KEYS="\ |
external.mc_incremental_prologue \ |
external.mc_incremental_epilogue \ |
external.weak_global_handles \ |
- mark \ |
mark.finish_incremental \ |
mark.prepare_code_flush \ |
mark.roots \ |
@@ -94,13 +115,27 @@ INTERESTING_OLD_GEN_KEYS="\ |
mark.weak_closure.weak_handles \ |
mark.weak_closure.weak_roots \ |
mark.weak_closure.harmony \ |
- sweep \ |
sweep.code \ |
sweep.map \ |
sweep.old \ |
- incremental_finalize \ |
" |
+if [[ "$TOP_LEVEL" = "yes" ]]; then |
+ INTERESTING_OLD_GEN_KEYS="\ |
+ ${INTERESTING_OLD_GEN_KEYS} \ |
+ clear \ |
+ evacuate \ |
+ finish \ |
+ incremental_finalize \ |
+ mark \ |
+ pause |
+ sweep \ |
+ " |
+ INTERESTING_NEW_GEN_KEYS="\ |
+ ${INTERESTING_NEW_GEN_KEYS} \ |
+ " |
+fi |
+ |
BASE_DIR=$(dirname $0) |
case $OP in |
@@ -109,6 +144,7 @@ case $OP in |
| $BASE_DIR/eval_gc_nvp.py \ |
--no-histogram \ |
--rank $RANK_MODE \ |
+ $CSV \ |
${INTERESTING_NEW_GEN_KEYS} |
;; |
old-gen-rank) |
@@ -116,9 +152,9 @@ case $OP in |
| $BASE_DIR/eval_gc_nvp.py \ |
--no-histogram \ |
--rank $RANK_MODE \ |
+ $CSV \ |
${INTERESTING_OLD_GEN_KEYS} |
;; |
*) |
;; |
esac |
- |