Index: tools/plot-timer-events |
diff --git a/tools/plot-timer-events b/tools/plot-timer-events |
index efa82bc5cda1bff133e1421f3a730165053d36bd..581e0ae333081dc421b976ca4b70d220f148980a 100755 |
--- a/tools/plot-timer-events |
+++ b/tools/plot-timer-events |
@@ -32,9 +32,40 @@ if [ ! -x "$d8_exec" ]; then |
exit 1 |
fi |
-# nm spits out 'no symbols found' messages to stderr. |
-cat $log_file | $d8_exec $tools_path/csvparser.js \ |
+if [ -n "$DISTORTION" ]; then |
+ distortion=$DISTORTION |
+else |
+ # Try to find out how much the instrumentation overhead is. |
+ calibration_log=calibration.log |
+ calibration_script="for (var i = 0; i < 1000000; i++) print();" |
+ |
+ $d8_exec --nocrankshaft --prof --logfile $calibration_log \ |
+ --log-timer-events -e "$calibration_script" > /dev/null |
+ t_1=`grep "V8.Execute" $calibration_log | tail -n1 | awk -F, '{print $4}'` |
+ n_1=`grep "timer-event" $calibration_log | wc -l` |
+ |
+ $d8_exec --nocrankshaft --prof --logfile $calibration_log \ |
+ --log-internal-timer-events -e "$calibration_script" > /dev/null |
+ t_2=`grep "V8.Execute" $calibration_log | tail -n1 | awk -F, '{print $4}'` |
+ n_2=`grep "timer-event" $calibration_log | wc -l` |
+ |
+ rm $calibration_log |
+ |
+ # Overhead in picoseconds. |
+ distortion=`echo "1000*($t_1 - $t_2)/($n_1 - $n_2)" | bc` |
+fi |
+ |
+if [ -n "$PLOT_RANGE" ]; then |
+ plot_range=$PLOT_RANGE |
+else |
+ plot_range=auto,auto |
+fi |
+ |
+echo "DISTORTION=$distortion" |
+echo "PLOT_RANGE=$plot_range" |
+ |
+echo -e "plot-range,$plot_range\ndistortion,$distortion" | cat - $log_file | |
+ $d8_exec $tools_path/csvparser.js \ |
$tools_path/splaytree.js $tools_path/codemap.js \ |
$tools_path/logreader.js $tools_path/plot-timer-events.js \ |
2>/dev/null | gnuplot > timer-events.png |
- |