[flutter_tool] Track APK sha calculation time (#33923)

This commit is contained in:
Zachary Anderson 2019-06-05 15:28:19 -07:00 committed by GitHub
parent b3382b9907
commit 5180201fe1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -61,7 +61,14 @@ String hex(List<int> bytes) {
}
String calculateSha(File file) {
return hex(sha1.convert(file.readAsBytesSync()).bytes);
final Stopwatch stopwatch = Stopwatch()..start();
final List<int> bytes = file.readAsBytesSync();
printTrace('calculateSha: reading file took ${stopwatch.elapsedMicroseconds}us');
stopwatch.reset();
final String sha = hex(sha1.convert(bytes).bytes);
stopwatch.stop();
printTrace('calculateSha: computing sha took ${stopwatch.elapsedMicroseconds}us');
return sha;
}
/// Convert `foo_bar` to `fooBar`.