| 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 25 matching lines...) Expand all Loading... |
| 36 var kV8BinarySuffixes = ["/d8", "/libv8.so"]; | 36 var kV8BinarySuffixes = ["/d8", "/libv8.so"]; |
| 37 var kStackFrames = 8; // Stack frames to display in the plot. | 37 var kStackFrames = 8; // Stack frames to display in the plot. |
| 38 | 38 |
| 39 var kTimerEventWidth = 0.33; // Width of each timeline. | 39 var kTimerEventWidth = 0.33; // Width of each timeline. |
| 40 var kExecutionFrameWidth = 0.2; // Width of the top stack frame line. | 40 var kExecutionFrameWidth = 0.2; // Width of the top stack frame line. |
| 41 var kStackFrameWidth = 0.1; // Width of the lower stack frame lines. | 41 var kStackFrameWidth = 0.1; // Width of the lower stack frame lines. |
| 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 kMaxDeoptLength = 4; // Draw size of the largest deopt. | 47 var kMaxDeoptLength = 4; // Draw size of the largest deopt. |
| 47 var kPauseLabelPadding = 5; // Padding for pause time labels. | 48 var kPauseLabelPadding = 5; // Padding for pause time labels. |
| 48 var kNumPauseLabels = 7; // Number of biggest pauses to label. | 49 var kNumPauseLabels = 7; // Number of biggest pauses to label. |
| 49 var kCodeKindLabelPadding = 100; // Padding for code kind labels. | 50 var kCodeKindLabelPadding = 100; // Padding for code kind labels. |
| 50 | 51 |
| 51 var kTickHalfDuration = 0.5; // Duration of half a tick in ms. | 52 var kTickHalfDuration = 0.5; // Duration of half a tick in ms. |
| 52 var kMinRangeLength = 0.0005; // Minimum length for an event in ms. | 53 var kMinRangeLength = 0.0005; // Minimum length for an event in ms. |
| 53 | 54 |
| 54 var kNumThreads = 2; // Number of threads. | 55 var kNumThreads = 2; // Number of threads. |
| 55 var kExecutionThreadId = 0; // ID of main thread. | 56 var kExecutionThreadId = 0; // ID of main thread. |
| (...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 129 'code stub': new CodeKind("#FF00FF", [2]), | 130 'code stub': new CodeKind("#FF00FF", [2]), |
| 130 'built-in ': new CodeKind("#AA00AA", [3]), | 131 'built-in ': new CodeKind("#AA00AA", [3]), |
| 131 'inl.cache': new CodeKind("#4444AA", | 132 'inl.cache': new CodeKind("#4444AA", |
| 132 [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]), | 133 [4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]), |
| 133 'reg.exp. ': new CodeKind("#0000FF", [15]), | 134 'reg.exp. ': new CodeKind("#0000FF", [15]), |
| 134 }; | 135 }; |
| 135 | 136 |
| 136 var code_map = new CodeMap(); | 137 var code_map = new CodeMap(); |
| 137 var execution_pauses = []; | 138 var execution_pauses = []; |
| 138 var deopts = []; | 139 var deopts = []; |
| 140 var gettime = []; |
| 139 var event_stack = []; | 141 var event_stack = []; |
| 140 var last_time_stamp = []; | 142 var last_time_stamp = []; |
| 141 for (var i = 0; i < kNumThreads; i++) { | 143 for (var i = 0; i < kNumThreads; i++) { |
| 142 event_stack[i] = []; | 144 event_stack[i] = []; |
| 143 last_time_stamp[i] = -1; | 145 last_time_stamp[i] = -1; |
| 144 } | 146 } |
| 145 | 147 |
| 146 var range_start = undefined; | 148 var range_start = undefined; |
| 147 var range_end = undefined; | 149 var range_end = undefined; |
| 148 var obj_index = 0; | 150 var obj_index = 0; |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 267 }; | 269 }; |
| 268 | 270 |
| 269 var processCodeDeleteEvent = function(address) { | 271 var processCodeDeleteEvent = function(address) { |
| 270 code_map.deleteCode(address); | 272 code_map.deleteCode(address); |
| 271 }; | 273 }; |
| 272 | 274 |
| 273 var processCodeDeoptEvent = function(time, size) { | 275 var processCodeDeoptEvent = function(time, size) { |
| 274 deopts.push(new Deopt(time, size)); | 276 deopts.push(new Deopt(time, size)); |
| 275 } | 277 } |
| 276 | 278 |
| 279 var processCurrentTimeEvent = function(time) { |
| 280 gettime.push(time); |
| 281 } |
| 282 |
| 277 var processSharedLibrary = function(name, start, end) { | 283 var processSharedLibrary = function(name, start, end) { |
| 278 var code_entry = new CodeMap.CodeEntry(end - start, name); | 284 var code_entry = new CodeMap.CodeEntry(end - start, name); |
| 279 code_entry.kind = -3; // External code kind. | 285 code_entry.kind = -3; // External code kind. |
| 280 for (var i = 0; i < kV8BinarySuffixes.length; i++) { | 286 for (var i = 0; i < kV8BinarySuffixes.length; i++) { |
| 281 var suffix = kV8BinarySuffixes[i]; | 287 var suffix = kV8BinarySuffixes[i]; |
| 282 if (name.indexOf(suffix, name.length - suffix.length) >= 0) { | 288 if (name.indexOf(suffix, name.length - suffix.length) >= 0) { |
| 283 code_entry.kind = -1; // V8 runtime code kind. | 289 code_entry.kind = -1; // V8 runtime code kind. |
| 284 break; | 290 break; |
| 285 } | 291 } |
| 286 } | 292 } |
| (...skipping 22 matching lines...) Expand all Loading... |
| 309 'shared-library': { parsers: [null, parseInt, parseInt], | 315 'shared-library': { parsers: [null, parseInt, parseInt], |
| 310 processor: processSharedLibrary }, | 316 processor: processSharedLibrary }, |
| 311 'code-creation': { parsers: [null, parseInt, parseInt, parseInt, null], | 317 'code-creation': { parsers: [null, parseInt, parseInt, parseInt, null], |
| 312 processor: processCodeCreateEvent }, | 318 processor: processCodeCreateEvent }, |
| 313 'code-move': { parsers: [parseInt, parseInt], | 319 'code-move': { parsers: [parseInt, parseInt], |
| 314 processor: processCodeMoveEvent }, | 320 processor: processCodeMoveEvent }, |
| 315 'code-delete': { parsers: [parseInt], | 321 'code-delete': { parsers: [parseInt], |
| 316 processor: processCodeDeleteEvent }, | 322 processor: processCodeDeleteEvent }, |
| 317 'code-deopt': { parsers: [parseTimeStamp, parseInt], | 323 'code-deopt': { parsers: [parseTimeStamp, parseInt], |
| 318 processor: processCodeDeoptEvent }, | 324 processor: processCodeDeoptEvent }, |
| 325 'current-time': { parsers: [parseTimeStamp], |
| 326 processor: processCurrentTimeEvent }, |
| 319 'tick': { parsers: [parseInt, parseTimeStamp, | 327 'tick': { parsers: [parseInt, parseTimeStamp, |
| 320 null, null, parseInt, 'var-args'], | 328 null, null, parseInt, 'var-args'], |
| 321 processor: processTickEvent } | 329 processor: processTickEvent } |
| 322 }); | 330 }); |
| 323 | 331 |
| 324 var line; | 332 var line; |
| 325 while (line = input()) { | 333 while (line = input()) { |
| 326 logreader.processLogLine(line); | 334 logreader.processLogLine(line); |
| 327 } | 335 } |
| 328 | 336 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 384 output("set xlabel \"execution time in ms\""); | 392 output("set xlabel \"execution time in ms\""); |
| 385 output("set xrange [" + range_start + ":" + range_end + "]"); | 393 output("set xrange [" + range_start + ":" + range_end + "]"); |
| 386 output("set style fill pattern 2 bo 1"); | 394 output("set style fill pattern 2 bo 1"); |
| 387 output("set style rect fs solid 1 noborder"); | 395 output("set style rect fs solid 1 noborder"); |
| 388 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\""); |
| 389 output("set border 15 lw 0.2"); // Draw thin border box. | 397 output("set border 15 lw 0.2"); // Draw thin border box. |
| 390 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\""); |
| 391 output("set xtics out nomirror"); | 399 output("set xtics out nomirror"); |
| 392 output("unset key"); | 400 output("unset key"); |
| 393 | 401 |
| 394 function DrawBarBase(color, start, end, top, bottom) { | 402 function DrawBarBase(color, start, end, top, bottom, transparency) { |
| 395 obj_index++; | 403 obj_index++; |
| 396 command = "set object " + obj_index + " rect"; | 404 command = "set object " + obj_index + " rect"; |
| 397 command += " from " + start + ", " + top; | 405 command += " from " + start + ", " + top; |
| 398 command += " to " + end + ", " + bottom; | 406 command += " to " + end + ", " + bottom; |
| 399 command += " fc rgb \"" + color + "\""; | 407 command += " fc rgb \"" + color + "\""; |
| 408 if (transparency) { |
| 409 command += " fs transparent solid " + transparency; |
| 410 } |
| 400 output(command); | 411 output(command); |
| 401 } | 412 } |
| 402 | 413 |
| 403 function DrawBar(row, color, start, end, width) { | 414 function DrawBar(row, color, start, end, width) { |
| 404 DrawBarBase(color, start, end, row + width, row - width); | 415 DrawBarBase(color, start, end, row + width, row - width); |
| 405 } | 416 } |
| 406 | 417 |
| 407 function DrawHalfBar(row, color, start, end, width) { | 418 function DrawHalfBar(row, color, start, end, width) { |
| 408 DrawBarBase(color, start, end, row, row - width); | 419 DrawBarBase(color, start, end, row, row - width); |
| 409 } | 420 } |
| (...skipping 13 matching lines...) Expand all Loading... |
| 423 deopts.sort(function(a, b) { return b.size - a.size; }); | 434 deopts.sort(function(a, b) { return b.size - a.size; }); |
| 424 var max_deopt_size = deopts.length > 0 ? deopts[0].size : Infinity; | 435 var max_deopt_size = deopts.length > 0 ? deopts[0].size : Infinity; |
| 425 | 436 |
| 426 for (var i = 0; i < deopts.length; i++) { | 437 for (var i = 0; i < deopts.length; i++) { |
| 427 var deopt = deopts[i]; | 438 var deopt = deopts[i]; |
| 428 DrawHalfBar(kDeoptRow, "#9944CC", deopt.time, | 439 DrawHalfBar(kDeoptRow, "#9944CC", deopt.time, |
| 429 deopt.time + 10 * pause_tolerance, | 440 deopt.time + 10 * pause_tolerance, |
| 430 deopt.size / max_deopt_size * kMaxDeoptLength); | 441 deopt.size / max_deopt_size * kMaxDeoptLength); |
| 431 } | 442 } |
| 432 | 443 |
| 444 // Plot current time polls. |
| 445 if (gettime.length > 1) { |
| 446 var start = gettime[0]; |
| 447 var end = gettime.pop(); |
| 448 DrawBarBase("#0000BB", start, end, kGetTimeHeight, 0, 0.2); |
| 449 } |
| 450 |
| 433 // Name Y-axis. | 451 // Name Y-axis. |
| 434 var ytics = []; | 452 var ytics = []; |
| 435 for (name in TimerEvents) { | 453 for (name in TimerEvents) { |
| 436 var index = TimerEvents[name].index; | 454 var index = TimerEvents[name].index; |
| 437 var label = TimerEvents[name].label; | 455 var label = TimerEvents[name].label; |
| 438 ytics.push('"' + label + ' (' + percentages[name] + '%%)" ' + index); | 456 ytics.push('"' + label + ' (' + percentages[name] + '%%)" ' + index); |
| 439 } | 457 } |
| 440 ytics.push('"code kind color coding" ' + kY1Offset); | 458 ytics.push('"code kind color coding" ' + kY1Offset); |
| 441 ytics.push('"code kind in execution" ' + (kY1Offset - 1)); | 459 ytics.push('"code kind in execution" ' + (kY1Offset - 1)); |
| 442 ytics.push('"top ' + kStackFrames + ' js stack frames"' + ' ' + | 460 ytics.push('"top ' + kStackFrames + ' js stack frames"' + ' ' + |
| (...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 524 output("plot '-' using 1:2 axes x1y2 with impulses ls 1"); | 542 output("plot '-' using 1:2 axes x1y2 with impulses ls 1"); |
| 525 for (var i = 0; i < execution_pauses.length; i++) { | 543 for (var i = 0; i < execution_pauses.length; i++) { |
| 526 var pause = execution_pauses[i]; | 544 var pause = execution_pauses[i]; |
| 527 output(pause.end + " " + pause.duration()); | 545 output(pause.end + " " + pause.duration()); |
| 528 obj_index++; | 546 obj_index++; |
| 529 } | 547 } |
| 530 output("e"); | 548 output("e"); |
| 531 return obj_index; | 549 return obj_index; |
| 532 }; | 550 }; |
| 533 } | 551 } |
| OLD | NEW |