OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 # | 2 # |
3 # Copyright 2015 the V8 project authors. All rights reserved. | 3 # Copyright 2015 the V8 project authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Convenience Script used to rank GC NVP output. | 7 # Convenience Script used to rank GC NVP output. |
8 | 8 |
9 print_usage_and_die() { | 9 print_usage_and_die() { |
10 echo "Usage: $0 RANK SORT [LOGFILE]" | 10 echo "Usage: $0 [OPTIONS]" |
11 echo "" | 11 echo "" |
12 echo "Arguments:" | 12 echo "OPTIONS" |
13 echo " RANK: old-gen-rank | new-gen-rank" | 13 echo " -r|--rank new-gen-rank|old-gen-rank GC mode to profile" |
14 echo " SORT: max | avg" | 14 echo " (default: old-gen-rank)" |
15 echo " LOGFILE: the file to process. will default to /dev/stdin" | 15 echo " -s|--sort avg|max sorting mode (default: max)" |
| 16 echo " -t|--top-level include top-level categories" |
| 17 echo " -c|--csv provide csv output" |
| 18 echo " -f|--file FILE profile input in a file" |
| 19 echo " (default: stdin)" |
16 exit 1 | 20 exit 1 |
17 } | 21 } |
18 | 22 |
19 if [[ $# -lt 2 || $# -gt 3 ]]; then | 23 OP=old-gen-rank |
| 24 RANK_MODE=max |
| 25 TOP_LEVEL=no |
| 26 CSV="" |
| 27 LOGFILE=/dev/stdin |
| 28 |
| 29 while [[ $# -ge 1 ]] |
| 30 do |
| 31 key="$1" |
| 32 case $key in |
| 33 -r|--rank) |
| 34 case $2 in |
| 35 new-gen-rank|old-gen-rank) |
| 36 OP="$2" |
| 37 ;; |
| 38 *) |
| 39 print_usage_and_die |
| 40 esac |
| 41 shift |
| 42 ;; |
| 43 -s|--sort) |
| 44 case $2 in |
| 45 max|avg) |
| 46 RANK_MODE=$2 |
| 47 ;; |
| 48 *) |
| 49 print_usage_and_die |
| 50 esac |
| 51 shift |
| 52 ;; |
| 53 -t|--top-level) |
| 54 TOP_LEVEL=yes |
| 55 ;; |
| 56 -c|--csv) |
| 57 CSV=" --csv " |
| 58 ;; |
| 59 -f|--file) |
| 60 LOGFILE=$2 |
| 61 shift |
| 62 ;; |
| 63 *) |
| 64 break |
| 65 ;; |
| 66 esac |
| 67 shift |
| 68 done |
| 69 |
| 70 if [[ $# -ne 0 ]]; then |
| 71 echo "Unknown option(s): $@" |
| 72 echo "" |
20 print_usage_and_die | 73 print_usage_and_die |
21 fi | 74 fi |
22 | 75 |
23 case $1 in | |
24 new-gen-rank|old-gen-rank) | |
25 OP=$1 | |
26 ;; | |
27 *) | |
28 print_usage_and_die | |
29 esac | |
30 | |
31 case $2 in | |
32 max|avg) | |
33 RANK_MODE=$2 | |
34 ;; | |
35 *) | |
36 print_usage_and_die | |
37 esac | |
38 | |
39 if [ $# -eq 3 ]; then | |
40 LOGFILE=$3 | |
41 else | |
42 LOGFILE=/dev/stdin | |
43 fi | |
44 | |
45 GENERAL_INTERESTING_KEYS="\ | |
46 pause \ | |
47 " | |
48 | |
49 INTERESTING_NEW_GEN_KEYS="\ | 76 INTERESTING_NEW_GEN_KEYS="\ |
50 ${GENERAL_INTERESTING_KEYS} \ | |
51 scavenge \ | 77 scavenge \ |
52 weak \ | 78 weak \ |
53 roots \ | 79 roots \ |
54 old_new \ | 80 old_new \ |
55 code \ | 81 code \ |
56 semispace \ | 82 semispace \ |
57 object_groups \ | 83 object_groups \ |
58 " | 84 " |
59 | 85 |
60 INTERESTING_OLD_GEN_KEYS="\ | 86 INTERESTING_OLD_GEN_KEYS="\ |
61 ${GENERAL_INTERESTING_KEYS} \ | |
62 clear \ | |
63 clear.code_flush \ | 87 clear.code_flush \ |
64 clear.dependent_code \ | 88 clear.dependent_code \ |
65 clear.global_handles \ | 89 clear.global_handles \ |
66 clear.maps \ | 90 clear.maps \ |
67 clear.slots_buffer \ | 91 clear.slots_buffer \ |
68 clear.store_buffer \ | 92 clear.store_buffer \ |
69 clear.string_table \ | 93 clear.string_table \ |
70 clear.weak_cells \ | 94 clear.weak_cells \ |
71 clear.weak_collections \ | 95 clear.weak_collections \ |
72 clear.weak_lists \ | 96 clear.weak_lists \ |
73 finish \ | |
74 evacuate \ | |
75 evacuate.candidates \ | 97 evacuate.candidates \ |
76 evacuate.clean_up \ | 98 evacuate.clean_up \ |
77 evacuate.copy \ | 99 evacuate.copy \ |
78 evacuate.update_pointers \ | 100 evacuate.update_pointers \ |
79 evacuate.update_pointers.between_evacuated \ | 101 evacuate.update_pointers.between_evacuated \ |
80 evacuate.update_pointers.to_evacuated \ | 102 evacuate.update_pointers.to_evacuated \ |
81 evacuate.update_pointers.to_new \ | 103 evacuate.update_pointers.to_new \ |
82 evacuate.update_pointers.weak \ | 104 evacuate.update_pointers.weak \ |
83 external.mc_prologue \ | 105 external.mc_prologue \ |
84 external.mc_epilogue \ | 106 external.mc_epilogue \ |
85 external.mc_incremental_prologue \ | 107 external.mc_incremental_prologue \ |
86 external.mc_incremental_epilogue \ | 108 external.mc_incremental_epilogue \ |
87 external.weak_global_handles \ | 109 external.weak_global_handles \ |
88 mark \ | |
89 mark.finish_incremental \ | 110 mark.finish_incremental \ |
90 mark.prepare_code_flush \ | 111 mark.prepare_code_flush \ |
91 mark.roots \ | 112 mark.roots \ |
92 mark.weak_closure \ | 113 mark.weak_closure \ |
93 mark.weak_closure.ephemeral \ | 114 mark.weak_closure.ephemeral \ |
94 mark.weak_closure.weak_handles \ | 115 mark.weak_closure.weak_handles \ |
95 mark.weak_closure.weak_roots \ | 116 mark.weak_closure.weak_roots \ |
96 mark.weak_closure.harmony \ | 117 mark.weak_closure.harmony \ |
97 sweep \ | |
98 sweep.code \ | 118 sweep.code \ |
99 sweep.map \ | 119 sweep.map \ |
100 sweep.old \ | 120 sweep.old \ |
101 incremental_finalize \ | |
102 " | 121 " |
103 | 122 |
| 123 if [[ "$TOP_LEVEL" = "yes" ]]; then |
| 124 INTERESTING_OLD_GEN_KEYS="\ |
| 125 ${INTERESTING_OLD_GEN_KEYS} \ |
| 126 clear \ |
| 127 evacuate \ |
| 128 finish \ |
| 129 incremental_finalize \ |
| 130 mark \ |
| 131 pause |
| 132 sweep \ |
| 133 " |
| 134 INTERESTING_NEW_GEN_KEYS="\ |
| 135 ${INTERESTING_NEW_GEN_KEYS} \ |
| 136 " |
| 137 fi |
| 138 |
104 BASE_DIR=$(dirname $0) | 139 BASE_DIR=$(dirname $0) |
105 | 140 |
106 case $OP in | 141 case $OP in |
107 new-gen-rank) | 142 new-gen-rank) |
108 cat $LOGFILE | grep "gc=s" \ | 143 cat $LOGFILE | grep "gc=s" \ |
109 | $BASE_DIR/eval_gc_nvp.py \ | 144 | $BASE_DIR/eval_gc_nvp.py \ |
110 --no-histogram \ | 145 --no-histogram \ |
111 --rank $RANK_MODE \ | 146 --rank $RANK_MODE \ |
| 147 $CSV \ |
112 ${INTERESTING_NEW_GEN_KEYS} | 148 ${INTERESTING_NEW_GEN_KEYS} |
113 ;; | 149 ;; |
114 old-gen-rank) | 150 old-gen-rank) |
115 cat $LOGFILE | grep "gc=ms" \ | 151 cat $LOGFILE | grep "gc=ms" \ |
116 | $BASE_DIR/eval_gc_nvp.py \ | 152 | $BASE_DIR/eval_gc_nvp.py \ |
117 --no-histogram \ | 153 --no-histogram \ |
118 --rank $RANK_MODE \ | 154 --rank $RANK_MODE \ |
| 155 $CSV \ |
119 ${INTERESTING_OLD_GEN_KEYS} | 156 ${INTERESTING_OLD_GEN_KEYS} |
120 ;; | 157 ;; |
121 *) | 158 *) |
122 ;; | 159 ;; |
123 esac | 160 esac |
124 | |
OLD | NEW |