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

Commit d65025e8 authored by Rafal Slawik's avatar Rafal Slawik Committed by Automerger Merge Worker
Browse files

Merge "Check if CPU time tracking is expected to work" into sc-dev am: 64454600

Original change: https://googleplex-android-review.googlesource.com/c/platform/frameworks/base/+/13431931

MUST ONLY BE SUBMITTED BY AUTOMERGER

Change-Id: I920dccd78260efb691c8fa9092f0b1dd97bfa062
parents 4b5b7b80 64454600
Loading
Loading
Loading
Loading
+1 −4
Original line number Original line Diff line number Diff line
@@ -24,10 +24,7 @@ public final class KernelCpuTotalBpfMapReader {
    }
    }


    /** Returns whether total CPU time is measured. */
    /** Returns whether total CPU time is measured. */
    public static boolean isSupported() {
    public static native boolean isSupported();
        // TODO(b/174245730): Implement this check.
        return true;
    }


    /** Reads total CPU time from bpf map. */
    /** Reads total CPU time from bpf map. */
    public static native boolean read(Callback callback);
    public static native boolean read(Callback callback);
+5 −0
Original line number Original line Diff line number Diff line
@@ -20,6 +20,10 @@


namespace android {
namespace android {


static jboolean KernelCpuTotalBpfMapReader_isSupported(JNIEnv *, jobject) {
    return android::bpf::isTrackingUidTimesSupported() ? JNI_TRUE : JNI_FALSE;
}

static jboolean KernelCpuTotalBpfMapReader_read(JNIEnv *env, jobject, jobject callback) {
static jboolean KernelCpuTotalBpfMapReader_read(JNIEnv *env, jobject, jobject callback) {
    jclass callbackClass = env->GetObjectClass(callback);
    jclass callbackClass = env->GetObjectClass(callback);
    jmethodID callbackMethod = env->GetMethodID(callbackClass, "accept", "(IIJ)V");
    jmethodID callbackMethod = env->GetMethodID(callbackClass, "accept", "(IIJ)V");
@@ -47,6 +51,7 @@ static jboolean KernelCpuTotalBpfMapReader_read(JNIEnv *env, jobject, jobject ca
static const JNINativeMethod methods[] = {
static const JNINativeMethod methods[] = {
        {"read", "(Lcom/android/internal/os/KernelCpuTotalBpfMapReader$Callback;)Z",
        {"read", "(Lcom/android/internal/os/KernelCpuTotalBpfMapReader$Callback;)Z",
         (void *)KernelCpuTotalBpfMapReader_read},
         (void *)KernelCpuTotalBpfMapReader_read},
        {"isSupported", "()Z", (void *)KernelCpuTotalBpfMapReader_isSupported},
};
};


int register_com_android_internal_os_KernelCpuTotalBpfMapReader(JNIEnv *env) {
int register_com_android_internal_os_KernelCpuTotalBpfMapReader(JNIEnv *env) {