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