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

Commit bcd02117 authored by Nandana Dutt's avatar Nandana Dutt Committed by android-build-merger
Browse files

Merge "dumpstate: Log duration only if significant" am: 48159a81 am: ec1ee7d8

am: 2bb8c6b1

Change-Id: Iac7077af0b42b239ec2d47cee2f1003b1dc48098
parents e86aaa2c 2bb8c6b1
Loading
Loading
Loading
Loading
+6 −4
Original line number Original line Diff line number Diff line
@@ -102,14 +102,16 @@ DurationReporter::DurationReporter(const std::string& title, bool logcat_only)


DurationReporter::~DurationReporter() {
DurationReporter::~DurationReporter() {
    if (!title_.empty()) {
    if (!title_.empty()) {
        uint64_t elapsed = Nanotime() - started_;
        float elapsed = (float)(Nanotime() - started_) / NANOS_PER_SEC;
        MYLOGD("Duration of '%s': %.3fs\n", title_.c_str(), (float)elapsed / NANOS_PER_SEC);
        if (elapsed < .5f) {
            return;
        }
        MYLOGD("Duration of '%s': %.2fs\n", title_.c_str(), elapsed);
        if (logcat_only_) {
        if (logcat_only_) {
            return;
            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", elapsed, title_.c_str());
               title_.c_str());
    }
    }
}
}