summaryrefslogtreecommitdiff
path: root/cmds/dumpstate/utils.cpp
diff options
context:
space:
mode:
author Nandana Dutt <nandana@google.com> 2019-03-14 10:45:22 -0700
committer android-build-merger <android-build-merger@google.com> 2019-03-14 10:45:22 -0700
commit2bb8c6b1d741c7899da6a61fce9bdcad94ca89d0 (patch)
treec5727462e0a02572ec1c5e122ec6cc72475b11b9 /cmds/dumpstate/utils.cpp
parenta0d8e7dfd3935f83b07071561425f31f8eee20d9 (diff)
parentec1ee7d8a4cd8e1e7b220c68b1be49b9003cd195 (diff)
Merge "dumpstate: Log duration only if significant" am: 48159a81be
am: ec1ee7d8a4 Change-Id: Ia1548988f8acc3d17a1e99427d494d9f0aa489b2
Diffstat (limited to 'cmds/dumpstate/utils.cpp')
-rw-r--r--cmds/dumpstate/utils.cpp10
1 files changed, 6 insertions, 4 deletions
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 8b9298820d..4efa99b59b 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -102,14 +102,16 @@ DurationReporter::DurationReporter(const std::string& title, bool logcat_only)
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());
}
}