OLD | NEW |
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 482 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
493 " enhanced font 'Helvetica,10'"); | 493 " enhanced font 'Helvetica,10'"); |
494 print("set yrange [0:" + (num_timer_event + 1) + "]"); | 494 print("set yrange [0:" + (num_timer_event + 1) + "]"); |
495 print("set xlabel \"execution time in ms\""); | 495 print("set xlabel \"execution time in ms\""); |
496 print("set xrange [" + xrange_start + ":" + xrange_end + "]"); | 496 print("set xrange [" + xrange_start + ":" + xrange_end + "]"); |
497 print("set style fill pattern 2 bo 1"); | 497 print("set style fill pattern 2 bo 1"); |
498 print("set style rect fs solid 1 noborder"); | 498 print("set style rect fs solid 1 noborder"); |
499 print("set style line 1 lt 1 lw 1 lc rgb \"#000000\""); | 499 print("set style line 1 lt 1 lw 1 lc rgb \"#000000\""); |
500 print("set xtics out nomirror"); | 500 print("set xtics out nomirror"); |
501 print("unset key"); | 501 print("unset key"); |
502 | 502 |
| 503 var percentages = {}; |
| 504 var total = 0; |
| 505 for (var name in TimerEvents) { |
| 506 var event = TimerEvents[name]; |
| 507 var ranges = MergeRanges(event.ranges); |
| 508 var exclude_ranges = [new Range(-Infinity, xrange_start), |
| 509 new Range(xrange_end, Infinity)]; |
| 510 ranges = ExcludeRanges(ranges, exclude_ranges); |
| 511 var sum = 0; |
| 512 for (var i = 0; i < ranges.length; i++) { |
| 513 sum += ranges[i].end - ranges[i].start; |
| 514 } |
| 515 percentages[name] = (sum / (xrange_end - xrange_start) * 100).toFixed(1); |
| 516 } |
| 517 |
503 // Name Y-axis. | 518 // Name Y-axis. |
504 var ytics = []; | 519 var ytics = []; |
505 for (name in TimerEvents) { | 520 for (name in TimerEvents) { |
506 var index = TimerEvents[name].index; | 521 var index = TimerEvents[name].index; |
507 ytics.push('"' + name + '"' + ' ' + index); | 522 ytics.push('"' + name + ' (' + percentages[name] + '%%)" ' + index); |
508 } | 523 } |
509 ytics.push('"code kind being executed"' + ' ' + (kY1Offset - 1)); | 524 ytics.push('"code kind being executed"' + ' ' + (kY1Offset - 1)); |
510 ytics.push('"top ' + kStackFrames + ' js stack frames"' + ' ' + | 525 ytics.push('"top ' + kStackFrames + ' js stack frames"' + ' ' + |
511 (kY1Offset - 2)); | 526 (kY1Offset - 2)); |
512 ytics.push('"pause times" 0'); | 527 ytics.push('"pause times" 0'); |
513 print("set ytics out nomirror (" + ytics.join(', ') + ")"); | 528 print("set ytics out nomirror (" + ytics.join(', ') + ")"); |
514 | 529 |
515 // Plot timeline. | 530 // Plot timeline. |
516 for (var name in TimerEvents) { | 531 for (var name in TimerEvents) { |
517 var event = TimerEvents[name]; | 532 var event = TimerEvents[name]; |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
586 for (var i = 0; i < execution_pauses.length; i++) { | 601 for (var i = 0; i < execution_pauses.length; i++) { |
587 var pause = execution_pauses[i]; | 602 var pause = execution_pauses[i]; |
588 print(pause.end + " " + pause.duration()); | 603 print(pause.end + " " + pause.duration()); |
589 } | 604 } |
590 print("e"); | 605 print("e"); |
591 } | 606 } |
592 | 607 |
593 | 608 |
594 CollectData(); | 609 CollectData(); |
595 GnuplotOutput(); | 610 GnuplotOutput(); |
OLD | NEW |