| 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 'package:observatory/cpu_profile.dart'; | 6 import 'package:observatory/sample_profile.dart'; |
| 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:unittest/unittest.dart'; | 9 import 'package:unittest/unittest.dart'; |
| 10 import 'test_helper.dart'; | 10 import 'test_helper.dart'; |
| 11 | 11 |
| 12 void verifyHelper(var root, bool exclusive) { | 12 void verifyHelper(var root, bool exclusive) { |
| 13 if (root.children.length == 0) { | 13 if (root.children.length == 0) { |
| 14 return; | 14 return; |
| 15 } | 15 } |
| 16 | 16 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 for (int i = 0; i < node.children.length; i++) { | 50 for (int i = 0; i < node.children.length; i++) { |
| 51 verifyHelper(node.children[i], exclusive); | 51 verifyHelper(node.children[i], exclusive); |
| 52 } | 52 } |
| 53 } | 53 } |
| 54 | 54 |
| 55 var tests = [ | 55 var tests = [ |
| 56 // Verify inclusive tries. | 56 // Verify inclusive tries. |
| 57 (VM vm) async { | 57 (VM vm) async { |
| 58 var response = | 58 var response = |
| 59 await vm.invokeRpc('_getNativeAllocationSamples', {'tags': 'None'}); | 59 await vm.invokeRpc('_getNativeAllocationSamples', {'tags': 'None'}); |
| 60 CpuProfile cpuProfile = new CpuProfile(); | 60 SampleProfile cpuProfile = new SampleProfile(); |
| 61 await cpuProfile.load(vm, response); | 61 await cpuProfile.load(vm, response); |
| 62 var codeTree = cpuProfile.loadCodeTree(M.ProfileTreeDirection.inclusive); | 62 var codeTree = cpuProfile.loadCodeTree(M.ProfileTreeDirection.inclusive); |
| 63 var functionTree = | 63 var functionTree = |
| 64 cpuProfile.loadFunctionTree(M.ProfileTreeDirection.inclusive); | 64 cpuProfile.loadFunctionTree(M.ProfileTreeDirection.inclusive); |
| 65 verify(codeTree, false); | 65 verify(codeTree, false); |
| 66 verify(functionTree, false); | 66 verify(functionTree, false); |
| 67 }, | 67 }, |
| 68 // Verify exclusive tries. | 68 // Verify exclusive tries. |
| 69 (VM vm) async { | 69 (VM vm) async { |
| 70 var response = | 70 var response = |
| 71 await vm.invokeRpc('_getNativeAllocationSamples', {'tags': 'None'}); | 71 await vm.invokeRpc('_getNativeAllocationSamples', {'tags': 'None'}); |
| 72 CpuProfile cpuProfile = new CpuProfile(); | 72 SampleProfile cpuProfile = new SampleProfile(); |
| 73 await cpuProfile.load(vm, response); | 73 await cpuProfile.load(vm, response); |
| 74 var codeTreeExclusive = | 74 var codeTreeExclusive = |
| 75 cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive); | 75 cpuProfile.loadCodeTree(M.ProfileTreeDirection.exclusive); |
| 76 var functionTreeExclusive = | 76 var functionTreeExclusive = |
| 77 cpuProfile.loadFunctionTree(M.ProfileTreeDirection.exclusive); | 77 cpuProfile.loadFunctionTree(M.ProfileTreeDirection.exclusive); |
| 78 verify(codeTreeExclusive, true); | 78 verify(codeTreeExclusive, true); |
| 79 verify(functionTreeExclusive, true); | 79 verify(functionTreeExclusive, true); |
| 80 } | 80 } |
| 81 ]; | 81 ]; |
| 82 | 82 |
| 83 main(args) async => runVMTests(args, tests); | 83 main(args) async => runVMTests(args, tests); |
| OLD | NEW |