Log raw output lines for debugging (#47)

This would help debug https://github.com/flutter/flutter/issues/45194
This commit is contained in:
liyuqian
2019-11-19 16:39:32 -08:00
committed by GitHub
parent 0e559ec2c9
commit cb58456da4
4 changed files with 13 additions and 8 deletions

View File

@ -1,3 +1,7 @@
## 0.1.5
* Print more logs for debugging.
## 0.1.4 ## 0.1.4
* Download depot_tools automatically. * Download depot_tools automatically.

View File

@ -6,7 +6,7 @@ compatible.
# Install # Install
First install Xcode 10 (https://developer.apple.com/download/more/), First install Xcode 10.3 (https://developer.apple.com/download/more/),
[dart](https://dart.dev/get-dart), and [dart](https://dart.dev/get-dart), and
[git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git). [git](https://git-scm.com/book/en/v2/Getting-Started-Installing-Git).
Make sure that `pub`, `git`, and `instruments` are on your path. Make sure that `pub`, `git`, and `instruments` are on your path.

View File

@ -31,6 +31,7 @@ class IosTraceParser {
final bool isVerbose; final bool isVerbose;
final String traceUtilityPath; final String traceUtilityPath;
List<String> _lines;
List<String> _gpuMeasurements; List<String> _gpuMeasurements;
List<String> _cpuMeasurements; List<String> _cpuMeasurements;
@ -44,13 +45,13 @@ class IosTraceParser {
print('TraceUtility stderr:\n${result.stderr.toString}\n\n'); print('TraceUtility stderr:\n${result.stderr.toString}\n\n');
throw Exception('TraceUtility failed with exit code ${result.exitCode}'); throw Exception('TraceUtility failed with exit code ${result.exitCode}');
} }
final List<String> lines = result.stderr.toString().split('\n'); _lines = result.stderr.toString().split('\n');
// toSet to remove duplicates // toSet to remove duplicates
_gpuMeasurements = _gpuMeasurements =
lines.where((String s) => s.contains('GPU')).toSet().toList(); _lines.where((String s) => s.contains('GPU')).toSet().toList();
_cpuMeasurements = _cpuMeasurements =
lines.where((String s) => s.contains(processName)).toSet().toList(); _lines.where((String s) => s.contains(processName)).toSet().toList();
_gpuMeasurements.sort(); _gpuMeasurements.sort();
_cpuMeasurements.sort(); _cpuMeasurements.sort();
@ -107,8 +108,9 @@ class IosTraceParser {
double _average(Iterable<double> values) { double _average(Iterable<double> values) {
if (values == null || values.isEmpty) { if (values == null || values.isEmpty) {
_gpuMeasurements.forEach(print); print('TraceUtility output:\n${_lines.join('\n')}\n\n');
_cpuMeasurements.forEach(print); print('GPU measurements:\n${_gpuMeasurements.join('\n')}\n\n');
print('CPU measurements:\n${_cpuMeasurements.join('\n')}\n\n');
throw Exception('No valid measurements found.'); throw Exception('No valid measurements found.');
} }
return values.reduce((double a, double b) => a + b) / values.length; return values.reduce((double a, double b) => a + b) / values.length;

View File

@ -4,9 +4,8 @@ description:
Currently there's only one tool to measure iOS CPU/GPU usages for Flutter's CI Currently there's only one tool to measure iOS CPU/GPU usages for Flutter's CI
tests. tests.
author: Flutter Team <flutter-dev@googlegroups.com>
homepage: https://github.com/flutter/packages/tree/master/packages/gauge homepage: https://github.com/flutter/packages/tree/master/packages/gauge
version: 0.1.4 version: 0.1.5
executables: executables:
gauge: gauge gauge: gauge