Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1329)

Unified Diff: sdk/lib/_internal/pub_generated/lib/src/utils.dart

Issue 600293002: Add some additional annotations for tracking pub performance. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Code review changes Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « sdk/lib/_internal/pub_generated/lib/src/entrypoint.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/pub_generated/lib/src/utils.dart
diff --git a/sdk/lib/_internal/pub_generated/lib/src/utils.dart b/sdk/lib/_internal/pub_generated/lib/src/utils.dart
index 5d7a87298c625ff73ffd481ec9103f8d70f6bcaf..21b6bf8f7f62e670b379d01416a9afe741da747b 100644
--- a/sdk/lib/_internal/pub_generated/lib/src/utils.dart
+++ b/sdk/lib/_internal/pub_generated/lib/src/utils.dart
@@ -101,6 +101,11 @@ String padRight(String source, int length) {
}
return result.toString();
}
+String padLeft(String source, int length, [String char]) {
+ if (char == null) char = ' ';
+ if (source.length >= length) return source;
+ return char * (length - source.length) + source;
+}
String namedSequence(String name, Iterable iter, [String plural]) {
if (iter.length == 1) return "$name ${iter.single}";
if (plural == null) plural = "${name}s";
@@ -441,8 +446,13 @@ String nicePath(String inputPath) {
String niceDuration(Duration duration) {
var result = duration.inMinutes > 0 ? "${duration.inMinutes}:" : "";
var s = duration.inSeconds % 59;
- var ms = (duration.inMilliseconds % 1000) ~/ 100;
- return result + "$s.${ms}s";
+ var ms = duration.inMilliseconds % 1000;
+ if (log.verbosity.isLevelVisible(log.Level.FINE)) {
+ ms = padLeft(ms.toString(), 3, '0');
+ } else {
+ ms ~/= 100;
+ }
+ return "$result$s.${ms}s";
}
String urlDecode(String encoded) =>
Uri.decodeComponent(encoded.replaceAll("+", " "));
« no previous file with comments | « sdk/lib/_internal/pub_generated/lib/src/entrypoint.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698