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

Commit 9e07b814 authored by Suprabh Shukla's avatar Suprabh Shukla Committed by Android (Google) Code Review
Browse files

Merge "Switching StatLogger to uptime"

parents e31a3122 21489b34
Loading
Loading
Loading
Loading
+9 −0
Original line number Diff line number Diff line
@@ -177,6 +177,15 @@ public final class SystemClock {
    @CriticalNative
    native public static long uptimeMillis();

    /**
     * Returns nanoseconds since boot, not counting time spent in deep sleep.
     *
     * @return nanoseconds of non-sleep uptime since boot.
     * @hide
     */
    @CriticalNative
    public static native long uptimeNanos();

    /**
     * Return {@link Clock} that starts at system boot, not counting time spent
     * in deep sleep.
+1 −1
Original line number Diff line number Diff line
@@ -84,7 +84,7 @@ public class StatLogger {
     * give it back to the {@link #logDurationStat(int, long)}} after the event.
     */
    public long getTime() {
        return SystemClock.elapsedRealtimeNanos() / 1000;
        return SystemClock.uptimeNanos() / 1000;
    }

    /**
+5 −2
Original line number Diff line number Diff line
@@ -37,10 +37,12 @@ namespace android {
static_assert(std::is_same<int64_t, jlong>::value, "jlong isn't an int64_t");
static_assert(std::is_same<decltype(uptimeMillis()), int64_t>::value,
        "uptimeMillis signature change, expected int64_t return value");
static_assert(std::is_same<decltype(uptimeNanos()), int64_t>::value,
        "uptimeNanos signature change, expected int64_t return value");
static_assert(std::is_same<decltype(elapsedRealtime()), int64_t>::value,
        "uptimeMillis signature change, expected int64_t return value");
        "elapsedRealtime signature change, expected int64_t return value");
static_assert(std::is_same<decltype(elapsedRealtimeNano()), int64_t>::value,
        "uptimeMillis signature change, expected int64_t return value");
        "elapsedRealtimeNano signature change, expected int64_t return value");

/*
 * native public static long currentThreadTimeMillis();
@@ -76,6 +78,7 @@ static const JNINativeMethod gMethods[] = {
    // All of these are @CriticalNative, so we can defer directly to SystemClock.h for
    // some of these
    { "uptimeMillis", "()J", (void*) uptimeMillis },
    { "uptimeNanos", "()J", (void*) uptimeNanos },
    { "elapsedRealtime", "()J", (void*) elapsedRealtime },
    { "elapsedRealtimeNanos", "()J", (void*) elapsedRealtimeNano },