Merge "dumpstate: Log duration only if significant" am: 48159a81be am: ec1ee7d8a4
am: 2bb8c6b1d7
Change-Id: Iac7077af0b42b239ec2d47cee2f1003b1dc48098
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index fe1e4b4..0bb80dc 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -102,14 +102,16 @@
DurationReporter::~DurationReporter() {
if (!title_.empty()) {
- uint64_t elapsed = Nanotime() - started_;
- MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC);
+ float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC;
+ if (elapsed < .5f) {
+ return;
+ }
+ MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed);
if (logcat_only_) {
return;
}
// Use "Yoda grammar" to make it easier to grep|sort sections.
- printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC,
- title_.c_str());
+ printf("------ %.3fs was the duration of '%s' ------\n", elapsed, title_.c_str());
}
}