[dart2js] be resilient if we can't compute RAM usage.
Under some configurations, we can't obtain an observatoryURI to compute the RAM utilization of dart2js. It appears this happens when building in product mode: "./tools/build.py -m product create_sdk". This changes the logic to return "N/A" when that happens. Change-Id: Ic8c9e89a09603558db3ac07ea696aed77f2eaca1 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/245781 Reviewed-by: Joshua Litt <joshualitt@google.com> Commit-Queue: Sigmund Cherem <sigmund@google.com>
This commit is contained in:
committed by
Commit Bot
parent
2591ed885b
commit
4f3714e595
@@ -18,10 +18,11 @@
|
||||
import 'dart:developer';
|
||||
import 'package:vm_service/vm_service_io.dart' as vm_service_io;
|
||||
|
||||
Future<int> _currentHeapCapacity() async {
|
||||
Future<int?> _currentHeapCapacity() async {
|
||||
final info =
|
||||
await Service.controlWebServer(enable: true, silenceOutput: true);
|
||||
final observatoryUri = info.serverUri!;
|
||||
final observatoryUri = info.serverUri;
|
||||
if (observatoryUri == null) return null;
|
||||
final wsUri = 'ws://${observatoryUri.authority}${observatoryUri.path}ws';
|
||||
final vmService = await vm_service_io.vmServiceConnectUri(wsUri);
|
||||
int sum = 0;
|
||||
@@ -35,5 +36,6 @@ Future<int> _currentHeapCapacity() async {
|
||||
|
||||
Future<String> currentHeapCapacityInMb() async {
|
||||
final capacity = await _currentHeapCapacity();
|
||||
if (capacity == null) return "N/A MB";
|
||||
return "${(capacity / (1024 * 1024)).toStringAsFixed(3)} MB";
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user