mirror of
https://github.com/dart-lang/sdk
synced 2024-09-19 14:43:32 +00:00
a6e3008ded
See: https://dart-review.googlesource.com/c/sdk/+/196026 TEST=Code cleanup exclusively (sorting imports); no new tests. Change-Id: Ib07a82ff418138c542d6a83cfab9aabbb285f866 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/196180 Auto-Submit: Phil Quitslund <pquitslund@google.com> Reviewed-by: Phil Quitslund <pquitslund@google.com> Reviewed-by: Brian Wilkerson <brianwilkerson@google.com> Reviewed-by: Ben Konyi <bkonyi@google.com> Reviewed-by: Bob Nystrom <rnystrom@google.com> Commit-Queue: Phil Quitslund <pquitslund@google.com>
73 lines
2.5 KiB
Dart
73 lines
2.5 KiB
Dart
// Copyright (c) 2019, the Dart project authors. Please see the AUTHORS file
|
|
// for details. All rights reserved. Use of this source code is governed by a
|
|
// BSD-style license that can be found in the LICENSE file.
|
|
|
|
import 'package:test/test.dart';
|
|
import 'package:vm_service/vm_service.dart';
|
|
|
|
import 'common/test_helper.dart';
|
|
|
|
Future<void> sleep(int milliseconds) =>
|
|
Future.delayed(Duration(milliseconds: milliseconds));
|
|
|
|
var tests = <IsolateTest>[
|
|
(VmService service, IsolateRef isolate) async {
|
|
final isolateId = isolate.id!;
|
|
|
|
AllocationProfile result = await service.getAllocationProfile(isolateId);
|
|
expect(result.dateLastAccumulatorReset, isNull);
|
|
expect(result.dateLastServiceGC, isNull);
|
|
expect(result.members!.length, isPositive);
|
|
|
|
ClassHeapStats member = result.members![0];
|
|
expect(member.instancesAccumulated, isNotNull);
|
|
expect(member.instancesCurrent, isNotNull);
|
|
expect(member.bytesCurrent, isNotNull);
|
|
expect(member.accumulatedSize, isNotNull);
|
|
|
|
// reset.
|
|
result = await service.getAllocationProfile(isolateId, reset: true);
|
|
final firstReset = result.dateLastAccumulatorReset;
|
|
expect(firstReset, isNotNull);
|
|
expect(result.dateLastServiceGC, isNull);
|
|
expect(result.members!.length, isPositive);
|
|
|
|
member = result.members![0];
|
|
expect(member.instancesAccumulated, isNotNull);
|
|
expect(member.instancesCurrent, isNotNull);
|
|
expect(member.bytesCurrent, isNotNull);
|
|
expect(member.accumulatedSize, isNotNull);
|
|
|
|
await sleep(1000);
|
|
|
|
result = await service.getAllocationProfile(isolateId, reset: true);
|
|
final secondReset = result.dateLastAccumulatorReset;
|
|
expect(secondReset, isNot(firstReset));
|
|
|
|
// gc.
|
|
result = await service.getAllocationProfile(isolateId, gc: true);
|
|
expect(result.dateLastAccumulatorReset, secondReset);
|
|
final firstGC = result.dateLastServiceGC;
|
|
expect(firstGC, isNotNull);
|
|
expect(result.members!.length, isPositive);
|
|
|
|
member = result.members![0];
|
|
expect(member.instancesAccumulated, isNotNull);
|
|
expect(member.instancesCurrent, isNotNull);
|
|
expect(member.bytesCurrent, isNotNull);
|
|
expect(member.accumulatedSize, isNotNull);
|
|
|
|
await sleep(1000);
|
|
|
|
result = await service.getAllocationProfile(isolateId, gc: true);
|
|
final secondGC = result.dateLastAccumulatorReset;
|
|
expect(secondGC, isNot(firstGC));
|
|
},
|
|
];
|
|
|
|
main([args = const <String>[]]) async => runIsolateTests(
|
|
args,
|
|
tests,
|
|
'get_allocation_profile_rpc_test.dart',
|
|
);
|