summaryrefslogtreecommitdiff
path: root/cmds/dumpstate/utils.cpp
diff options
context:
space:
mode:
author Treehugger Robot <treehugger-gerrit@google.com> 2019-03-11 14:18:57 +0000
committer Gerrit Code Review <noreply-gerritcodereview@google.com> 2019-03-11 14:18:57 +0000
commitea7255933ea33b4da6e0c55103b3166ab57eb8d7 (patch)
tree797f440bd42c19e20585fcd5faf6ee37216ec434 /cmds/dumpstate/utils.cpp
parent6644784eadf4f5204cb77bc8d255cea8cae769eb (diff)
parenta8470b82f1f9b3b40b98e9c813bdc4d71361c001 (diff)
Merge "Log duration to logcat always."
Diffstat (limited to 'cmds/dumpstate/utils.cpp')
-rw-r--r--cmds/dumpstate/utils.cpp18
1 files changed, 8 insertions, 10 deletions
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 802c1b1570..8b9298820d 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -93,8 +93,8 @@ Dumpstate& Dumpstate::GetInstance() {
return singleton_;
}
-DurationReporter::DurationReporter(const std::string& title, bool log_only)
- : title_(title), log_only_(log_only) {
+DurationReporter::DurationReporter(const std::string& title, bool logcat_only)
+ : title_(title), logcat_only_(logcat_only) {
if (!title_.empty()) {
started_ = Nanotime();
}
@@ -103,15 +103,13 @@ DurationReporter::DurationReporter(const std::string& title, bool log_only)
DurationReporter::~DurationReporter() {
if (!title_.empty()) {
uint64_t elapsed = Nanotime() - started_;
- if (log_only_) {
- MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC);
- } else {
- // TODO(124089395): Remove or rewrite when bugreport latency is fixed.
- MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC);
- // 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());
+ MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC);
+ 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());
}
}