Skip to content

improve gc event display #36

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Oct 2, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 9 additions & 7 deletions lib/logging/logging.dart
Original file line number Diff line number Diff line change
Expand Up @@ -133,20 +133,22 @@ class LoggingScreen extends Screen {

// Log GC events.
service.onGCEvent.listen((Event e) {
final Map<dynamic, dynamic> newSpace = e.json['new'];
final Map<dynamic, dynamic> oldSpace = e.json['old'];
final HeapSpace newSpace = HeapSpace.parse(e.json['new']);
final HeapSpace oldSpace = HeapSpace.parse(e.json['old']);
final Map<dynamic, dynamic> isolateRef = e.json['isolate'];

final int usedBytes = newSpace['used'] + oldSpace['used'];
final int capacityBytes = newSpace['capacity'] + oldSpace['capacity'];
final int usedBytes = newSpace.used + oldSpace.used;
final int capacityBytes = newSpace.capacity + oldSpace.capacity;

final int time = ((newSpace.time + oldSpace.time) * 1000).round();

final String summary = '${isolateRef['name']} • '
'${e.json['reason']} collection • '
'${e.json['reason']} collection $time ms • '
'${printMb(usedBytes)} MB used of ${printMb(capacityBytes)} MB';
final Map<String, dynamic> event = <String, dynamic>{
'reason': e.json['reason'],
'new': newSpace,
'old': oldSpace,
'new': newSpace.json,
'old': oldSpace.json,
'isolate': isolateRef,
};
final String message = jsonEncode(event);
Expand Down