Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(144)

Side by Side Diff: tools/profview/profile-utils.js

Issue 2753543006: [profiler] Web UI: add summary of opts/deopts. (Closed)
Patch Set: Address reviewer comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « tools/profview/index.html ('k') | tools/profview/profview.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 the V8 project authors. All rights reserved. 1 // Copyright 2017 the V8 project authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 "use strict" 5 "use strict"
6 6
7 let codeKinds = [ 7 let codeKinds = [
8 "UNKNOWN", 8 "UNKNOWN",
9 "CPPCOMP", 9 "CPPCOMP",
10 "CPPGC", 10 "CPPGC",
(...skipping 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 469
470 let tickCount = 0; 470 let tickCount = 0;
471 while (i < ticks.length && ticks[i].tm < endTime) { 471 while (i < ticks.length && ticks[i].tm < endTime) {
472 tree.addStack(file, i); 472 tree.addStack(file, i);
473 i++; 473 i++;
474 tickCount++; 474 tickCount++;
475 } 475 }
476 476
477 return tickCount; 477 return tickCount;
478 } 478 }
479
480 function computeOptimizationStats(file,
481 timeStart = -Infinity, timeEnd = Infinity) {
482 function newCollection() {
483 return { count : 0, functions : [], functionTable : [] };
484 }
485 function addToCollection(collection, code) {
486 collection.count++;
487 let funcData = collection.functionTable[code.func];
488 if (!funcData) {
489 funcData = { f : file.functions[code.func], instances : [] };
490 collection.functionTable[code.func] = funcData;
491 collection.functions.push(funcData);
492 }
493 funcData.instances.push(code);
494 }
495
496 let functionCount = 0;
497 let optimizedFunctionCount = 0;
498 let deoptimizedFunctionCount = 0;
499 let optimizations = newCollection();
500 let eagerDeoptimizations = newCollection();
501 let softDeoptimizations = newCollection();
502 let lazyDeoptimizations = newCollection();
503
504 for (let i = 0; i < file.functions.length; i++) {
505 let f = file.functions[i];
506
507 // Skip special SFIs that do not correspond to JS functions.
508 if (f.codes.length === 0) continue;
509 if (file.code[f.codes[0]].type !== "JS") continue;
510
511 functionCount++;
512 let optimized = false;
513 let deoptimized = false;
514
515 for (let j = 0; j < f.codes.length; j++) {
516 let code = file.code[f.codes[j]];
517 console.assert(code.type === "JS");
518 if (code.kind === "Opt") {
519 optimized = true;
520 if (code.tm >= timeStart && code.tm <= timeEnd) {
521 addToCollection(optimizations, code);
522 }
523 }
524 if (code.deopt) {
525 deoptimized = true;
526 if (code.deopt.tm >= timeStart && code.deopt.tm <= timeEnd) {
527 switch (code.deopt.bailoutType) {
528 case "lazy":
529 addToCollection(lazyDeoptimizations, code);
530 break;
531 case "eager":
532 addToCollection(eagerDeoptimizations, code);
533 break;
534 case "soft":
535 addToCollection(softDeoptimizations, code);
536 break;
537 }
538 }
539 }
540 }
541 if (optimized) {
542 optimizedFunctionCount++;
543 }
544 if (deoptimized) {
545 deoptimizedFunctionCount++;
546 }
547 }
548
549 function sortCollection(collection) {
550 collection.functions.sort(
551 (a, b) => a.instances.length - b.instances.length);
552 }
553
554 sortCollection(eagerDeoptimizations);
555 sortCollection(lazyDeoptimizations);
556 sortCollection(softDeoptimizations);
557 sortCollection(optimizations);
558
559 return {
560 functionCount,
561 optimizedFunctionCount,
562 deoptimizedFunctionCount,
563 optimizations,
564 eagerDeoptimizations,
565 lazyDeoptimizations,
566 softDeoptimizations,
567 };
568 }
OLDNEW
« no previous file with comments | « tools/profview/index.html ('k') | tools/profview/profview.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698