make microbenchmark logging verbose (#12858)
* make microbenchmark logging verbose * prefix JSON so it can be parsed in verbose mode
This commit is contained in:
parent
616a2ad6da
commit
35bb855c0d
@ -39,9 +39,13 @@ class BenchmarkResultPrinter {
|
||||
/// for computer consumption and once formatted as plain text for humans.
|
||||
void printToStdout() {
|
||||
// IMPORTANT: keep these values in sync with dev/devicelab/bin/tasks/microbenchmarks.dart
|
||||
print('================ RESULTS ================');
|
||||
print(_printJson());
|
||||
print('================ FORMATTED ==============');
|
||||
const String jsonStart = '================ RESULTS ================';
|
||||
const String jsonEnd = '================ FORMATTED ==============';
|
||||
const String jsonPrefix = ':::JSON:::';
|
||||
|
||||
print(jsonStart);
|
||||
print('$jsonPrefix ${_printJson()}');
|
||||
print(jsonEnd);
|
||||
print(_printPlainText());
|
||||
}
|
||||
|
||||
|
@ -33,8 +33,9 @@ TaskFunction createMicrobenchmarkTask() {
|
||||
await prepareProvisioningCertificates(appDir.path);
|
||||
return await _startFlutter(
|
||||
options: <String>[
|
||||
'--profile',
|
||||
'-v',
|
||||
// --release doesn't work on iOS due to code signing issues
|
||||
'--profile',
|
||||
'-d',
|
||||
device.deviceId,
|
||||
benchmarkPath,
|
||||
@ -72,6 +73,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
// IMPORTANT: keep these values in sync with dev/benchmarks/microbenchmarks/lib/common.dart
|
||||
const String jsonStart = '================ RESULTS ================';
|
||||
const String jsonEnd = '================ FORMATTED ==============';
|
||||
const String jsonPrefix = ':::JSON:::';
|
||||
bool jsonStarted = false;
|
||||
final StringBuffer jsonBuf = new StringBuffer();
|
||||
final Completer<Map<String, double>> completer = new Completer<Map<String, double>>();
|
||||
@ -83,7 +85,6 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
stderr.writeln('[STDERR] $line');
|
||||
});
|
||||
|
||||
int prefixLength = 0;
|
||||
bool processWasKilledIntentionally = false;
|
||||
final StreamSubscription<String> stdoutSub = process.stdout
|
||||
.transform(const Utf8Decoder())
|
||||
@ -93,7 +94,6 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
|
||||
if (line.contains(jsonStart)) {
|
||||
jsonStarted = true;
|
||||
prefixLength = line.indexOf(jsonStart);
|
||||
return;
|
||||
}
|
||||
|
||||
@ -106,7 +106,7 @@ Future<Map<String, double>> _readJsonResults(Process process) {
|
||||
}
|
||||
|
||||
if (jsonStarted)
|
||||
jsonBuf.writeln(line.substring(prefixLength));
|
||||
jsonBuf.writeln(line.substring(line.indexOf(jsonPrefix) + jsonPrefix.length));
|
||||
});
|
||||
|
||||
process.exitCode.then<int>((int code) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user