Skip to content

Commit 21cbb2a

Browse files
aamcommit-bot@chromium.org
authored andcommitted
[analysis_server/benchmark] Fix memory usage calculation to avoid double-counting.
When several isolates share same isolate group, they share the same heap. This change iterates over isolate groups and aggregates their heap size instead of iterating over isolates. Change-Id: I83b04110277b3a2d22ab758b50ee8c4ce480ea7f Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212382 Commit-Queue: Alexander Aprelev <[email protected]> Reviewed-by: Martin Kustermann <[email protected]>
1 parent f67d4b3 commit 21cbb2a

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

pkg/analysis_server/benchmark/perf/memory_tests.dart

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -254,14 +254,11 @@ mixin ServerMemoryUsageMixin {
254254

255255
var total = 0;
256256

257-
List isolateRefs = vm['isolates'];
258-
for (Map isolateRef in isolateRefs) {
259-
var isolate =
260-
await service.call('getIsolate', {'isolateId': isolateRef['id']});
261-
262-
Map _heaps = isolate['_heaps'];
263-
total += _heaps['new']['used'] + _heaps['new']['external'] as int;
264-
total += _heaps['old']['used'] + _heaps['old']['external'] as int;
257+
List isolateGroupsRefs = vm['isolateGroups'];
258+
for (Map isolateGroupRef in isolateGroupsRefs) {
259+
final heapUsage = await service.call('getIsolateGroupMemoryUsage',
260+
{'isolateGroupId': isolateGroupRef['id']});
261+
total += heapUsage['heapUsage'] + heapUsage['externalUsage'] as int;
265262
}
266263

267264
service.dispose();

0 commit comments

Comments
 (0)