OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 // VMOptions=--error_on_bad_type --error_on_bad_override | 4 // VMOptions=--error_on_bad_type --error_on_bad_override |
5 | 5 |
6 import 'dart:developer'; | 6 import 'dart:developer'; |
7 import 'package:observatory/models.dart' as M; | 7 import 'package:observatory/models.dart' as M; |
8 import 'package:observatory/service_io.dart'; | 8 import 'package:observatory/service_io.dart'; |
9 import 'package:observatory/cpu_profile.dart'; | 9 import 'package:observatory/cpu_profile.dart'; |
10 import 'package:unittest/unittest.dart'; | 10 import 'package:unittest/unittest.dart'; |
11 import 'service_test_common.dart'; | 11 import 'service_test_common.dart'; |
12 import 'test_helper.dart'; | 12 import 'test_helper.dart'; |
13 | 13 |
14 void verifyHelper(var root, bool exclusive) { | 14 void verifyHelper(var root, bool exclusive) { |
15 if (root.children.length == 0) { | 15 if (root.children.length == 0) { |
16 return; | 16 return; |
17 } | 17 } |
18 | 18 |
19 /* if (!(root is FunctionCallTreeNode)) { | |
20 print('${root.profileCode.code.name}'); | |
21 } else { | |
22 print('${root.profileFunction.function.name}'); | |
23 } | |
24 */ | |
25 int inclusiveAllocations = 0; | 19 int inclusiveAllocations = 0; |
26 int exclusiveAllocations = 0; | 20 int exclusiveAllocations = 0; |
27 | 21 |
28 for (int i = 0; i < root.children.length; i++) { | 22 for (int i = 0; i < root.children.length; i++) { |
29 inclusiveAllocations += root.children[i].inclusiveNativeAllocations; | 23 inclusiveAllocations += root.children[i].inclusiveNativeAllocations; |
30 exclusiveAllocations += root.children[i].exclusiveNativeAllocations; | 24 exclusiveAllocations += root.children[i].exclusiveNativeAllocations; |
31 } | 25 } |
32 | 26 |
33 int rootMemory; | 27 int rootMemory; |
34 if (exclusive) { | 28 if (exclusive) { |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 var codeTreeExclusive = | 70 var codeTreeExclusive = |
77 cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive); | 71 cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive); |
78 var functionTreeExclusive = | 72 var functionTreeExclusive = |
79 cpuProfile.loadFunctionTree(M.ProfileTreeDirection.exclusive); | 73 cpuProfile.loadFunctionTree(M.ProfileTreeDirection.exclusive); |
80 verify(codeTreeExclusive, true); | 74 verify(codeTreeExclusive, true); |
81 verify(functionTreeExclusive, true); | 75 verify(functionTreeExclusive, true); |
82 } | 76 } |
83 ]; | 77 ]; |
84 | 78 |
85 main(args) async => runVMTests(args, tests); | 79 main(args) async => runVMTests(args, tests); |
OLD | NEW |