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 | 4 |
5 import 'dart:io'; | 5 import 'dart:io'; |
6 | 6 |
7 import 'package:analysis_server/src/utilities/profiling.dart'; | 7 import 'package:analysis_server/src/utilities/profiling.dart'; |
8 import 'package:test/test.dart'; | 8 import 'package:test/test.dart'; |
9 | 9 |
10 main() { | 10 main() { |
11 group('ProcessProfiler', () { | 11 group('ProcessProfiler', () { |
12 // Skip on windows. | 12 // Skip on windows. |
13 if (Platform.isWindows) { | 13 if (Platform.isWindows) { |
14 return; | 14 return; |
15 } | 15 } |
16 | 16 |
17 test('getProfilerForPlatform', () async { | 17 test('getProfilerForPlatform', () async { |
18 expect(ProcessProfiler.getProfilerForPlatform(), isNotNull); | 18 expect(ProcessProfiler.getProfilerForPlatform(), isNotNull); |
19 }); | 19 }); |
20 | 20 |
21 // TODO: https://github.com/dart-lang/sdk/issues/29815 | 21 test('getProcessUsage', () async { |
22 // test('getProcessUsage', () async { | 22 ProcessProfiler profiler = ProcessProfiler.getProfilerForPlatform(); |
23 // ProcessProfiler profiler = ProcessProfiler.getProfilerForPlatform(); | 23 UsageInfo info = await profiler.getProcessUsage(pid); |
24 // UsageInfo info = await profiler.getProcessUsage(pid); | 24 |
25 // | 25 expect(info, isNotNull); |
26 // expect(info, isNotNull); | 26 expect(info.cpuPercentage, greaterThanOrEqualTo(0.0)); |
27 // expect(info.cpuPercentage, greaterThanOrEqualTo(0.0)); | 27 expect(info.memoryKB, greaterThanOrEqualTo(0)); |
28 // expect(info.memoryKB, greaterThanOrEqualTo(0)); | 28 }); |
29 // }); | |
30 }); | 29 }); |
31 } | 30 } |
OLD | NEW |