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

Side by Side Diff: runtime/observatory/lib/src/cpu_profile/cpu_profile.dart

Issue 2977803002: [observatory] Sort native allocation profiles by size. (Closed)
Patch Set: Created 3 years, 5 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 | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 part of cpu_profiler; 5 part of cpu_profiler;
6 6
7 abstract class CallTreeNode<NodeT extends M.CallTreeNode> 7 abstract class CallTreeNode<NodeT extends M.CallTreeNode>
8 implements M.CallTreeNode { 8 implements M.CallTreeNode {
9 final List<NodeT> children; 9 final List<NodeT> children;
10 final int count; 10 final int count;
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 if (inclusive) { 98 if (inclusive) {
99 node._percentage = 99 node._percentage =
100 parentPercentage * (node.inclusiveNativeAllocations / parentMemory); 100 parentPercentage * (node.inclusiveNativeAllocations / parentMemory);
101 } else { 101 } else {
102 node._percentage = (node.inclusiveNativeAllocations / parentMemory); 102 node._percentage = (node.inclusiveNativeAllocations / parentMemory);
103 } 103 }
104 for (var child in node.children) { 104 for (var child in node.children) {
105 _setCodeMemoryPercentage(node, child); 105 _setCodeMemoryPercentage(node, child);
106 } 106 }
107 node.children.sort((a, b) {
108 return b.inclusiveNativeAllocations - a.inclusiveNativeAllocations;
109 });
107 } 110 }
108 111
109 _recordCallerAndCalleesInner( 112 _recordCallerAndCalleesInner(
110 CodeCallTreeNode caller, CodeCallTreeNode callee) { 113 CodeCallTreeNode caller, CodeCallTreeNode callee) {
111 if (caller != null) { 114 if (caller != null) {
112 caller.profileCode._recordCallee(callee.profileCode, callee.count); 115 caller.profileCode._recordCallee(callee.profileCode, callee.count);
113 callee.profileCode._recordCaller(caller.profileCode, caller.count); 116 callee.profileCode._recordCaller(caller.profileCode, caller.count);
114 } 117 }
115 118
116 for (var child in callee.children) { 119 for (var child in callee.children) {
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after
409 } 412 }
410 if (inclusive) { 413 if (inclusive) {
411 node._percentage = 414 node._percentage =
412 parentPercentage * (node.inclusiveNativeAllocations / parentMemory); 415 parentPercentage * (node.inclusiveNativeAllocations / parentMemory);
413 } else { 416 } else {
414 node._percentage = (node.inclusiveNativeAllocations / parentMemory); 417 node._percentage = (node.inclusiveNativeAllocations / parentMemory);
415 } 418 }
416 for (var child in node.children) { 419 for (var child in node.children) {
417 _setFunctionMemoryPercentage(node, child); 420 _setFunctionMemoryPercentage(node, child);
418 } 421 }
422 node.children.sort((a, b) {
423 return b.inclusiveNativeAllocations - a.inclusiveNativeAllocations;
424 });
419 } 425 }
420 426
421 _markFunctionCallsInner( 427 _markFunctionCallsInner(
422 FunctionCallTreeNode caller, FunctionCallTreeNode callee) { 428 FunctionCallTreeNode caller, FunctionCallTreeNode callee) {
423 if (caller != null) { 429 if (caller != null) {
424 caller.profileFunction 430 caller.profileFunction
425 ._recordCallee(callee.profileFunction, callee.count); 431 ._recordCallee(callee.profileFunction, callee.count);
426 callee.profileFunction 432 callee.profileFunction
427 ._recordCaller(caller.profileFunction, caller.count); 433 ._recordCaller(caller.profileFunction, caller.count);
428 } 434 }
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
1075 } 1081 }
1076 1082
1077 int approximateMillisecondsForCount(count) { 1083 int approximateMillisecondsForCount(count) {
1078 return (count * samplePeriod) ~/ Duration.MICROSECONDS_PER_MILLISECOND; 1084 return (count * samplePeriod) ~/ Duration.MICROSECONDS_PER_MILLISECOND;
1079 } 1085 }
1080 1086
1081 double approximateSecondsForCount(count) { 1087 double approximateSecondsForCount(count) {
1082 return (count * samplePeriod) / Duration.MICROSECONDS_PER_SECOND; 1088 return (count * samplePeriod) / Duration.MICROSECONDS_PER_SECOND;
1083 } 1089 }
1084 } 1090 }
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698