OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # find the name of the log file to process, it must not start with a dash. | 3 # find the name of the log file to process, it must not start with a dash. |
4 log_file="v8.log" | 4 log_file="v8.log" |
5 for arg in "$@" | 5 for arg in "$@" |
6 do | 6 do |
7 if ! expr "X${arg}" : "^X-" > /dev/null; then | 7 if ! expr "X${arg}" : "^X-" > /dev/null; then |
8 log_file=${arg} | 8 log_file=${arg} |
9 fi | 9 fi |
10 done | 10 done |
11 | 11 |
12 tools_path=`cd $(dirname "$0");pwd` | 12 tools_path=`cd $(dirname "$0");pwd` |
13 if [ ! "$D8_PATH" ]; then | 13 if test ! "$D8_PATH"; then |
14 d8_public=`which d8` | 14 d8_public=`which d8` |
15 if [ -x "$d8_public" ]; then D8_PATH=$(dirname "$d8_public"); fi | 15 if test -x "$d8_public"; then D8_PATH=$(dirname "$d8_public"); fi |
16 fi | 16 fi |
17 [ -n "$D8_PATH" ] || D8_PATH=$tools_path/.. | 17 |
| 18 if test -n "$D8_PATH"; then |
| 19 D8_PATH=$tools_path/.. |
| 20 fi |
| 21 |
18 d8_exec=$D8_PATH/d8 | 22 d8_exec=$D8_PATH/d8 |
19 | 23 |
20 if [ ! -x "$d8_exec" ]; then | 24 if test ! -x "$d8_exec"; then |
21 D8_PATH=`pwd`/out/native | 25 D8_PATH=`pwd`/out/native |
22 d8_exec=$D8_PATH/d8 | 26 d8_exec=$D8_PATH/d8 |
23 fi | 27 fi |
24 | 28 |
25 if [ ! -x "$d8_exec" ]; then | 29 if test ! -x "$d8_exec"; then |
26 d8_exec=`grep -m 1 -o '".*/d8"' $log_file | sed 's/"//g'` | 30 d8_exec=`grep -m 1 -o '".*/d8"' $log_file | sed 's/"//g'` |
27 fi | 31 fi |
28 | 32 |
29 if [ ! -x "$d8_exec" ]; then | 33 if test ! -x "$d8_exec"; then |
30 echo "d8 shell not found in $D8_PATH" | 34 echo "d8 shell not found in $D8_PATH" |
31 echo "To build, execute 'make native' from the V8 directory" | 35 echo "To build, execute 'make native' from the V8 directory" |
32 exit 1 | 36 exit 1 |
33 fi | 37 fi |
34 | 38 |
35 if [[ "$@" != *--distortion* ]]; then | 39 |
| 40 contains=0; |
| 41 for arg in "$@"; do |
| 42 `echo "$arg" | grep -q "^--distortion"` |
| 43 if test $? -eq 0; then |
| 44 contains=1 |
| 45 break |
| 46 fi |
| 47 done |
| 48 |
| 49 if test "$contains" -eq 0; then |
36 # Try to find out how much the instrumentation overhead is. | 50 # Try to find out how much the instrumentation overhead is. |
37 calibration_log=calibration.log | 51 calibration_log=calibration.log |
38 calibration_script="for (var i = 0; i < 1000000; i++) print();" | 52 calibration_script="for (var i = 0; i < 1000000; i++) print();" |
39 | 53 |
40 $d8_exec --nocrankshaft --prof --logfile $calibration_log \ | 54 $d8_exec --nocrankshaft --prof --logfile $calibration_log \ |
41 --log-timer-events -e "$calibration_script" > /dev/null | 55 --log-timer-events -e "$calibration_script" > /dev/null |
42 t_1_start=`grep "timer-event-start,\"V8.Execute\"" $calibration_log \ | 56 t_1_start=`grep "timer-event-start,\"V8.Execute\"" $calibration_log \ |
43 | tail -n1 | awk -F, '{print $3}'` | 57 | tail -n1 | awk -F, '{print $3}'` |
44 t_1_end=`grep "timer-event-end,\"V8.Execute\"" $calibration_log \ | 58 t_1_end=`grep "timer-event-end,\"V8.Execute\"" $calibration_log \ |
45 | tail -n1 | awk -F, '{print $3}'` | 59 | tail -n1 | awk -F, '{print $3}'` |
(...skipping 17 matching lines...) Expand all Loading... |
63 fi | 77 fi |
64 | 78 |
65 cat $log_file | | 79 cat $log_file | |
66 $d8_exec $tools_path/csvparser.js $tools_path/splaytree.js \ | 80 $d8_exec $tools_path/csvparser.js $tools_path/splaytree.js \ |
67 $tools_path/codemap.js $tools_path/profile.js $tools_path/profile_view.js \ | 81 $tools_path/codemap.js $tools_path/profile.js $tools_path/profile_view.js \ |
68 $tools_path/logreader.js $tools_path/tickprocessor.js \ | 82 $tools_path/logreader.js $tools_path/tickprocessor.js \ |
69 $tools_path/profviz/composer.js $tools_path/profviz/stdio.js \ | 83 $tools_path/profviz/composer.js $tools_path/profviz/stdio.js \ |
70 -- $@ $options 2>/dev/null > timer-events.plot | 84 -- $@ $options 2>/dev/null > timer-events.plot |
71 | 85 |
72 success=$? | 86 success=$? |
73 if [[ $success != 0 ]] ; then | 87 if test $success -ne 0; then |
74 cat timer-events.plot | 88 cat timer-events.plot |
75 else | 89 else |
76 cat timer-events.plot | gnuplot > timer-events.png | 90 cat timer-events.plot | gnuplot > timer-events.png |
77 fi | 91 fi |
78 | 92 |
79 rm -f timer-events.plot | 93 rm -f timer-events.plot |
OLD | NEW |