Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit af8b2d90 authored by chenqiwu's avatar chenqiwu
Browse files

dumpstate: allow printf the duration of command to bugreport



Google bring change b86f33be to ignore printting the duration
of command shorter than 500ms to bugreport. However, it is not
convenient for developers to grep|sort the dumpstate sections.

I think the right thing to do is:
(1) Keep the logcat logging the same:
     if (elapsed >= .5f || verbose_) {
         MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed);
      }
(2) printf the duration of command if logcat_only_ is false.

Change-Id: I947fdd514eb31b6a6058dd841d15ba41aba063ac
Signed-off-by: default avatarchenqiwu <chenqiwu@xiaomi.com>
parent 1cde0795
Loading
Loading
Loading
Loading
+5 −7
Original line number Original line Diff line number Diff line
@@ -2913,17 +2913,15 @@ DurationReporter::DurationReporter(const std::string& title, bool logcat_only, b
DurationReporter::~DurationReporter() {
DurationReporter::~DurationReporter() {
    if (!title_.empty()) {
    if (!title_.empty()) {
        float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC;
        float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC;
        if (elapsed < .5f && !verbose_) {
        if (elapsed >= .5f || verbose_) {
            return;
        }
            MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed);
            MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed);
        if (logcat_only_) {
            return;
        }
        }
        if (!logcat_only_) {
            // 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", elapsed, title_.c_str());
            printf("------ %.3fs was the duration of '%s' ------\n", elapsed, title_.c_str());
        }
        }
    }
    }
}


const int32_t Progress::kDefaultMax = 5000;
const int32_t Progress::kDefaultMax = 5000;