| OLD | NEW |
| 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 class CodeCallTreeNode { | 7 class CodeCallTreeNode { |
| 8 final ProfileCode profileCode; | 8 final ProfileCode profileCode; |
| 9 final int count; | 9 final int count; |
| 10 double get percentage => _percentage; | 10 double get percentage => _percentage; |
| (...skipping 25 matching lines...) Expand all Loading... |
| 36 node._percentage = parentPercentage * (node.count / parentCount); | 36 node._percentage = parentPercentage * (node.count / parentCount); |
| 37 } else { | 37 } else { |
| 38 node._percentage = (node.count / parentCount); | 38 node._percentage = (node.count / parentCount); |
| 39 } | 39 } |
| 40 for (var child in node.children) { | 40 for (var child in node.children) { |
| 41 _setCodePercentage(node, child); | 41 _setCodePercentage(node, child); |
| 42 } | 42 } |
| 43 } | 43 } |
| 44 | 44 |
| 45 _recordCallerAndCalleesInner(CodeCallTreeNode caller, | 45 _recordCallerAndCalleesInner(CodeCallTreeNode caller, |
| 46 CodeCallTreeNode callee) { | 46 CodeCallTreeNode callee) { |
| 47 if (caller != null) { | 47 if (caller != null) { |
| 48 caller.profileCode._recordCallee(callee.profileCode, callee.count); | 48 caller.profileCode._recordCallee(callee.profileCode, callee.count); |
| 49 callee.profileCode._recordCaller(caller.profileCode, callee.count); | 49 callee.profileCode._recordCaller(caller.profileCode, caller.count); |
| 50 } | 50 } |
| 51 | 51 |
| 52 for (var child in callee.children) { | 52 for (var child in callee.children) { |
| 53 _recordCallerAndCalleesInner(callee, child); | 53 _recordCallerAndCalleesInner(callee, child); |
| 54 } | 54 } |
| 55 } | 55 } |
| 56 | 56 |
| 57 _recordCallerAndCallees() { | 57 _recordCallerAndCallees() { |
| 58 for (var child in root.children) { | 58 for (var child in root.children) { |
| 59 _recordCallerAndCalleesInner(null, child); | 59 _recordCallerAndCalleesInner(null, child); |
| (...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 283 node._percentage = parentPercentage * (node.count / parentCount); | 283 node._percentage = parentPercentage * (node.count / parentCount); |
| 284 } else { | 284 } else { |
| 285 node._percentage = (node.count / parentCount); | 285 node._percentage = (node.count / parentCount); |
| 286 } | 286 } |
| 287 for (var child in node.children) { | 287 for (var child in node.children) { |
| 288 _setFunctionPercentage(node, child); | 288 _setFunctionPercentage(node, child); |
| 289 } | 289 } |
| 290 } | 290 } |
| 291 | 291 |
| 292 _markFunctionCallsInner(FunctionCallTreeNode caller, | 292 _markFunctionCallsInner(FunctionCallTreeNode caller, |
| 293 FunctionCallTreeNode callee) { | 293 FunctionCallTreeNode callee) { |
| 294 if (caller != null) { | 294 if (caller != null) { |
| 295 caller.profileFunction._recordCallee(callee.profileFunction, callee.count)
; | 295 caller.profileFunction._recordCallee(callee.profileFunction, callee.count)
; |
| 296 callee.profileFunction._recordCaller(caller.profileFunction, callee.count)
; | 296 callee.profileFunction._recordCaller(caller.profileFunction, caller.count)
; |
| 297 } | 297 } |
| 298 for (var child in callee.children) { | 298 for (var child in callee.children) { |
| 299 _markFunctionCallsInner(callee, child); | 299 _markFunctionCallsInner(callee, child); |
| 300 } | 300 } |
| 301 } | 301 } |
| 302 | 302 |
| 303 _markFunctionCalls() { | 303 _markFunctionCalls() { |
| 304 for (var child in root.children) { | 304 for (var child in root.children) { |
| 305 _markFunctionCallsInner(null, child); | 305 _markFunctionCallsInner(null, child); |
| 306 } | 306 } |
| (...skipping 553 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 860 int approximateMillisecondsForCount(count) { | 860 int approximateMillisecondsForCount(count) { |
| 861 var MICROSECONDS_PER_MILLISECOND = 1000.0; | 861 var MICROSECONDS_PER_MILLISECOND = 1000.0; |
| 862 return (count * samplePeriod) ~/ MICROSECONDS_PER_MILLISECOND; | 862 return (count * samplePeriod) ~/ MICROSECONDS_PER_MILLISECOND; |
| 863 } | 863 } |
| 864 | 864 |
| 865 double approximateSecondsForCount(count) { | 865 double approximateSecondsForCount(count) { |
| 866 var MICROSECONDS_PER_SECOND = 1000000.0; | 866 var MICROSECONDS_PER_SECOND = 1000000.0; |
| 867 return (count * samplePeriod) / MICROSECONDS_PER_SECOND; | 867 return (count * samplePeriod) / MICROSECONDS_PER_SECOND; |
| 868 } | 868 } |
| 869 } | 869 } |
| OLD | NEW |