Loading cmds/dumpstate/dumpstate.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -73,13 +73,13 @@ extern "C" { */ */ class DurationReporter { class DurationReporter { public: public: explicit DurationReporter(const std::string& title, bool log_only = false); explicit DurationReporter(const std::string& title, bool logcat_only = false); ~DurationReporter(); ~DurationReporter(); private: private: std::string title_; std::string title_; bool log_only_; bool logcat_only_; uint64_t started_; uint64_t started_; DISALLOW_COPY_AND_ASSIGN(DurationReporter); DISALLOW_COPY_AND_ASSIGN(DurationReporter); Loading cmds/dumpstate/utils.cpp +8 −10 Original line number Original line Diff line number Diff line Loading @@ -93,8 +93,8 @@ Dumpstate& Dumpstate::GetInstance() { return singleton_; return singleton_; } } DurationReporter::DurationReporter(const std::string& title, bool log_only) DurationReporter::DurationReporter(const std::string& title, bool logcat_only) : title_(title), log_only_(log_only) { : title_(title), logcat_only_(logcat_only) { if (!title_.empty()) { if (!title_.empty()) { started_ = Nanotime(); started_ = Nanotime(); } } Loading @@ -103,17 +103,15 @@ DurationReporter::DurationReporter(const std::string& title, bool log_only) DurationReporter::~DurationReporter() { DurationReporter::~DurationReporter() { if (!title_.empty()) { if (!title_.empty()) { uint64_t elapsed = Nanotime() - started_; 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); 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. // Use "Yoda grammar" to make it easier to grep|sort sections. printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC, printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC, title_.c_str()); title_.c_str()); } } } } } const int32_t Progress::kDefaultMax = 5000; const int32_t Progress::kDefaultMax = 5000; Loading Loading
cmds/dumpstate/dumpstate.h +2 −2 Original line number Original line Diff line number Diff line Loading @@ -73,13 +73,13 @@ extern "C" { */ */ class DurationReporter { class DurationReporter { public: public: explicit DurationReporter(const std::string& title, bool log_only = false); explicit DurationReporter(const std::string& title, bool logcat_only = false); ~DurationReporter(); ~DurationReporter(); private: private: std::string title_; std::string title_; bool log_only_; bool logcat_only_; uint64_t started_; uint64_t started_; DISALLOW_COPY_AND_ASSIGN(DurationReporter); DISALLOW_COPY_AND_ASSIGN(DurationReporter); Loading
cmds/dumpstate/utils.cpp +8 −10 Original line number Original line Diff line number Diff line Loading @@ -93,8 +93,8 @@ Dumpstate& Dumpstate::GetInstance() { return singleton_; return singleton_; } } DurationReporter::DurationReporter(const std::string& title, bool log_only) DurationReporter::DurationReporter(const std::string& title, bool logcat_only) : title_(title), log_only_(log_only) { : title_(title), logcat_only_(logcat_only) { if (!title_.empty()) { if (!title_.empty()) { started_ = Nanotime(); started_ = Nanotime(); } } Loading @@ -103,17 +103,15 @@ DurationReporter::DurationReporter(const std::string& title, bool log_only) DurationReporter::~DurationReporter() { DurationReporter::~DurationReporter() { if (!title_.empty()) { if (!title_.empty()) { uint64_t elapsed = Nanotime() - started_; 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); 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. // Use "Yoda grammar" to make it easier to grep|sort sections. printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC, printf("------ %.3fs was the duration of '%s' ------\n", (float)elapsed / NANOS_PER_SEC, title_.c_str()); title_.c_str()); } } } } } const int32_t Progress::kDefaultMax = 5000; const int32_t Progress::kDefaultMax = 5000; Loading