Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 the V8 project authors. All rights reserved. | 1 // Copyright 2013 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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 42 var kGapWidth = 0.05; // Gap between stack frame lines. | 42 var kGapWidth = 0.05; // Gap between stack frame lines. |
| 43 | 43 |
| 44 var kY1Offset = 11; // Offset for stack frame vs. event lines. | 44 var kY1Offset = 11; // Offset for stack frame vs. event lines. |
| 45 var kDeoptRow = 7; // Row displaying deopts. | 45 var kDeoptRow = 7; // Row displaying deopts. |
| 46 var kGetTimeHeight = 0.5; // Height of marker displaying timed part. | 46 var kGetTimeHeight = 0.5; // Height of marker displaying timed part. |
| 47 var kMaxDeoptLength = 4; // Draw size of the largest deopt. | 47 var kMaxDeoptLength = 4; // Draw size of the largest deopt. |
| 48 var kPauseLabelPadding = 5; // Padding for pause time labels. | 48 var kPauseLabelPadding = 5; // Padding for pause time labels. |
| 49 var kNumPauseLabels = 7; // Number of biggest pauses to label. | 49 var kNumPauseLabels = 7; // Number of biggest pauses to label. |
| 50 var kCodeKindLabelPadding = 100; // Padding for code kind labels. | 50 var kCodeKindLabelPadding = 100; // Padding for code kind labels. |
| 51 | 51 |
| 52 var kTickHalfDuration = 0.5; // Duration of half a tick in ms. | 52 var kTickHalfDuration = 0.5; // Duration of half a tick in ms. |
|
Yang
2016/03/11 08:08:38
Can you update this comment and elsewhere to micro
| |
| 53 var kMinRangeLength = 0.0005; // Minimum length for an event in ms. | 53 var kMinRangeLength = 0.0005; // Minimum length for an event in ms. |
| 54 | 54 |
| 55 var kNumThreads = 2; // Number of threads. | 55 var kNumThreads = 2; // Number of threads. |
| 56 var kExecutionThreadId = 0; // ID of main thread. | 56 var kExecutionThreadId = 0; // ID of main thread. |
| 57 | 57 |
| 58 // Init values. | 58 // Init values. |
| 59 var num_timer_event = kY1Offset + 0.5; | 59 var num_timer_event = kY1Offset + 0.5; |
| 60 | 60 |
| 61 // Data structures. | 61 // Data structures. |
| 62 function TimerEvent(label, color, pause, thread_id) { | 62 function TimerEvent(label, color, pause, thread_id) { |
| 63 assert(thread_id >= 0 && thread_id < kNumThreads, "invalid thread id"); | 63 assert(thread_id >= 0 && thread_id < kNumThreads, "invalid thread id"); |
| 64 this.label = label; | 64 this.label = label; |
| 65 this.color = color; | 65 this.color = color; |
| 66 this.pause = pause; | 66 this.pause = pause; |
| 67 this.ranges = []; | 67 this.ranges = []; |
| 68 this.thread_id = thread_id; | 68 this.thread_id = thread_id; |
| 69 this.index = ++num_timer_event; | 69 this.index = ++num_timer_event; |
| 70 } | 70 } |
| 71 | 71 |
| 72 function CodeKind(color, kinds) { | 72 function CodeKind(color, kinds) { |
| 73 this.color = color; | 73 this.color = color; |
| 74 this.in_execution = []; | 74 this.in_execution = []; |
| 75 this.stack_frames = []; | 75 this.stack_frames = []; |
| 76 for (var i = 0; i < kStackFrames; i++) this.stack_frames.push([]); | 76 for (var i = 0; i < kStackFrames; i++) this.stack_frames.push([]); |
| 77 this.kinds = kinds; | 77 this.kinds = kinds; |
| 78 } | 78 } |
| 79 | 79 |
| 80 function Range(start, end) { | 80 function Range(start, end) { |
| 81 this.start = start; // In milliseconds. | 81 this.start = start; // In milliseconds. |
|
Yang
2016/03/11 08:08:38
microseconds here as well, and below.
| |
| 82 this.end = end; // In milliseconds. | 82 this.end = end; // In milliseconds. |
| 83 } | 83 } |
| 84 | 84 |
| 85 function Deopt(time, size) { | 85 function Deopt(time, size) { |
| 86 this.time = time; // In milliseconds. | 86 this.time = time; // In milliseconds. |
| 87 this.size = size; // In bytes. | 87 this.size = size; // In bytes. |
| 88 } | 88 } |
| 89 | 89 |
| 90 Range.prototype.duration = function() { return this.end - this.start; } | 90 Range.prototype.duration = function() { return this.end - this.start; } |
| 91 | 91 |
| 92 function Tick(tick) { | 92 function Tick(tick) { |
| 93 this.tick = tick; | 93 this.tick = tick; |
| 94 } | 94 } |
| 95 | 95 |
| 96 var TimerEvents = { | 96 var TimerEvents = { |
| 97 'V8.Execute': | 97 'V8.Execute': |
| 98 new TimerEvent("execution", "#000000", false, 0), | 98 new TimerEvent("execution", "#000000", false, 0), |
| 99 'V8.External': | 99 'V8.External': |
| 100 new TimerEvent("external", "#3399FF", false, 0), | 100 new TimerEvent("external", "#3399FF", false, 0), |
| 101 'V8.CompileFullCode': | 101 'V8.CompileFullCode': |
| 102 new TimerEvent("compile unopt", "#CC0000", true, 0), | 102 new TimerEvent("compile unopt", "#CC0000", true, 0), |
| 103 'V8.RecompileSynchronous': | 103 'V8.RecompileSynchronous': |
| 104 new TimerEvent("recompile sync", "#CC0044", true, 0), | 104 new TimerEvent("recompile sync", "#CC0044", true, 0), |
| 105 'V8.RecompileConcurrent': | 105 'V8.RecompileConcurrent': |
| 106 new TimerEvent("recompile async", "#CC4499", false, 1), | 106 new TimerEvent("recompile async", "#CC4499", false, 1), |
| 107 'V8.CompileEval': | 107 'V8.CompileEvalMicroSeconds': |
| 108 new TimerEvent("compile eval", "#CC4400", true, 0), | 108 new TimerEvent("compile eval", "#CC4400", true, 0), |
| 109 'V8.IcMiss': | 109 'V8.IcMiss': |
| 110 new TimerEvent("ic miss", "#CC9900", false, 0), | 110 new TimerEvent("ic miss", "#CC9900", false, 0), |
| 111 'V8.Parse': | 111 'V8.ParseMicroSeconds': |
| 112 new TimerEvent("parse", "#00CC00", true, 0), | 112 new TimerEvent("parse", "#00CC00", true, 0), |
| 113 'V8.PreParse': | 113 'V8.PreParseMicroSeconds': |
| 114 new TimerEvent("preparse", "#44CC00", true, 0), | 114 new TimerEvent("preparse", "#44CC00", true, 0), |
| 115 'V8.ParseLazy': | 115 'V8.ParseLazyMicroSeconds': |
| 116 new TimerEvent("lazy parse", "#00CC44", true, 0), | 116 new TimerEvent("lazy parse", "#00CC44", true, 0), |
| 117 'V8.GCScavenger': | 117 'V8.GCScavenger': |
| 118 new TimerEvent("gc scavenge", "#0044CC", true, 0), | 118 new TimerEvent("gc scavenge", "#0044CC", true, 0), |
| 119 'V8.GCCompactor': | 119 'V8.GCCompactor': |
| 120 new TimerEvent("gc compaction", "#4444CC", true, 0), | 120 new TimerEvent("gc compaction", "#4444CC", true, 0), |
| 121 'V8.GCContext': | 121 'V8.GCContext': |
| 122 new TimerEvent("gc context", "#4400CC", true, 0), | 122 new TimerEvent("gc context", "#4400CC", true, 0), |
| 123 }; | 123 }; |
| 124 | 124 |
| 125 var CodeKinds = { | 125 var CodeKinds = { |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 382 pause_tolerance = (range_end - range_start) / kResX / 10; | 382 pause_tolerance = (range_end - range_start) / kResX / 10; |
| 383 | 383 |
| 384 if (typeof result_callback === 'function') { | 384 if (typeof result_callback === 'function') { |
| 385 result_callback(range_start, range_end); | 385 result_callback(range_start, range_end); |
| 386 } | 386 } |
| 387 }; | 387 }; |
| 388 | 388 |
| 389 | 389 |
| 390 this.assembleOutput = function(output) { | 390 this.assembleOutput = function(output) { |
| 391 output("set yrange [0:" + (num_timer_event + 1) + "]"); | 391 output("set yrange [0:" + (num_timer_event + 1) + "]"); |
| 392 output("set xlabel \"execution time in ms\""); | 392 output("set xlabel \"execution time in ms\""); |
|
Yang
2016/03/11 08:08:38
"execution time in microseconds" please.
| |
| 393 output("set xrange [" + range_start + ":" + range_end + "]"); | 393 output("set xrange [" + range_start + ":" + range_end + "]"); |
| 394 output("set style fill pattern 2 bo 1"); | 394 output("set style fill pattern 2 bo 1"); |
| 395 output("set style rect fs solid 1 noborder"); | 395 output("set style rect fs solid 1 noborder"); |
| 396 output("set style line 1 lt 1 lw 1 lc rgb \"#000000\""); | 396 output("set style line 1 lt 1 lw 1 lc rgb \"#000000\""); |
| 397 output("set border 15 lw 0.2"); // Draw thin border box. | 397 output("set border 15 lw 0.2"); // Draw thin border box. |
| 398 output("set style line 2 lt 1 lw 1 lc rgb \"#9944CC\""); | 398 output("set style line 2 lt 1 lw 1 lc rgb \"#9944CC\""); |
| 399 output("set xtics out nomirror"); | 399 output("set xtics out nomirror"); |
| 400 output("unset key"); | 400 output("unset key"); |
| 401 | 401 |
| 402 function DrawBarBase(color, start, end, top, bottom, transparency) { | 402 function DrawBarBase(color, start, end, top, bottom, transparency) { |
| (...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 520 RestrictRangesTo(execution_pauses, range_start, range_end); | 520 RestrictRangesTo(execution_pauses, range_start, range_end); |
| 521 execution_pauses.sort( | 521 execution_pauses.sort( |
| 522 function(a, b) { return b.duration() - a.duration(); }); | 522 function(a, b) { return b.duration() - a.duration(); }); |
| 523 | 523 |
| 524 var max_pause_time = execution_pauses.length > 0 | 524 var max_pause_time = execution_pauses.length > 0 |
| 525 ? execution_pauses[0].duration() : 0; | 525 ? execution_pauses[0].duration() : 0; |
| 526 padding = kPauseLabelPadding * (range_end - range_start) / kResX; | 526 padding = kPauseLabelPadding * (range_end - range_start) / kResX; |
| 527 var y_scale = kY1Offset / max_pause_time / 2; | 527 var y_scale = kY1Offset / max_pause_time / 2; |
| 528 for (var i = 0; i < execution_pauses.length && i < kNumPauseLabels; i++) { | 528 for (var i = 0; i < execution_pauses.length && i < kNumPauseLabels; i++) { |
| 529 var pause = execution_pauses[i]; | 529 var pause = execution_pauses[i]; |
| 530 var label_content = (pause.duration() | 0) + " ms"; | 530 var label_content = (pause.duration() | 0) + " ms"; |
|
Yang
2016/03/11 08:08:38
" {/Symbol m}s" instead of " ms"
| |
| 531 var label_x = pause.end + padding; | 531 var label_x = pause.end + padding; |
| 532 var label_y = Math.max(1, (pause.duration() * y_scale)); | 532 var label_y = Math.max(1, (pause.duration() * y_scale)); |
| 533 output("set label \"" + label_content + "\" at " + | 533 output("set label \"" + label_content + "\" at " + |
| 534 label_x + "," + label_y + " font \"Helvetica,7'\""); | 534 label_x + "," + label_y + " font \"Helvetica,7'\""); |
| 535 obj_index++; | 535 obj_index++; |
| 536 } | 536 } |
| 537 | 537 |
| 538 // Scale second Y-axis appropriately. | 538 // Scale second Y-axis appropriately. |
| 539 var y2range = max_pause_time * num_timer_event / kY1Offset * 2; | 539 var y2range = max_pause_time * num_timer_event / kY1Offset * 2; |
| 540 output("set y2range [0:" + y2range + "]"); | 540 output("set y2range [0:" + y2range + "]"); |
| 541 // Plot graph with impulses as data set. | 541 // Plot graph with impulses as data set. |
| 542 output("plot '-' using 1:2 axes x1y2 with impulses ls 1"); | 542 output("plot '-' using 1:2 axes x1y2 with impulses ls 1"); |
| 543 for (var i = 0; i < execution_pauses.length; i++) { | 543 for (var i = 0; i < execution_pauses.length; i++) { |
| 544 var pause = execution_pauses[i]; | 544 var pause = execution_pauses[i]; |
| 545 output(pause.end + " " + pause.duration()); | 545 output(pause.end + " " + pause.duration()); |
| 546 obj_index++; | 546 obj_index++; |
| 547 } | 547 } |
| 548 output("e"); | 548 output("e"); |
| 549 return obj_index; | 549 return obj_index; |
| 550 }; | 550 }; |
| 551 } | 551 } |
| OLD | NEW |