Loading core/java/com/android/internal/os/KernelCpuBpfTracking.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.os; /** CPU tracking using eBPF. */ public final class KernelCpuBpfTracking { private KernelCpuBpfTracking() { } /** Returns whether CPU tracking using eBPF is supported. */ public static native boolean isSupported(); } core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java +0 −3 Original line number Diff line number Diff line Loading @@ -23,9 +23,6 @@ public final class KernelCpuTotalBpfMapReader { private KernelCpuTotalBpfMapReader() { } /** Returns whether total CPU time is measured. */ public static native boolean isSupported(); /** Reads total CPU time from bpf map. */ public static native boolean read(Callback callback); Loading core/jni/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ cc_library_shared { "com_android_internal_net_NetworkUtilsInternal.cpp", "com_android_internal_os_ClassLoaderFactory.cpp", "com_android_internal_os_FuseAppLoop.cpp", "com_android_internal_os_KernelCpuBpfTracking.cpp", "com_android_internal_os_KernelCpuTotalBpfMapReader.cpp", "com_android_internal_os_KernelCpuUidBpfMapReader.cpp", "com_android_internal_os_KernelSingleProcessCpuThreadReader.cpp", Loading core/jni/AndroidRuntime.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ extern int register_com_android_internal_content_om_OverlayConfig(JNIEnv *env); extern int register_com_android_internal_net_NetworkUtilsInternal(JNIEnv* env); extern int register_com_android_internal_os_ClassLoaderFactory(JNIEnv* env); extern int register_com_android_internal_os_FuseAppLoop(JNIEnv* env); extern int register_com_android_internal_os_KernelCpuBpfTracking(JNIEnv* env); extern int register_com_android_internal_os_KernelCpuTotalBpfMapReader(JNIEnv* env); extern int register_com_android_internal_os_KernelCpuUidBpfMapReader(JNIEnv *env); extern int register_com_android_internal_os_KernelSingleProcessCpuThreadReader(JNIEnv* env); Loading Loading @@ -1586,6 +1587,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_security_Scrypt), REG_JNI(register_com_android_internal_content_NativeLibraryHelper), REG_JNI(register_com_android_internal_os_FuseAppLoop), REG_JNI(register_com_android_internal_os_KernelCpuBpfTracking), REG_JNI(register_com_android_internal_os_KernelCpuTotalBpfMapReader), REG_JNI(register_com_android_internal_os_KernelCpuUidBpfMapReader), REG_JNI(register_com_android_internal_os_KernelSingleProcessCpuThreadReader), Loading core/jni/com_android_internal_os_KernelCpuBpfTracking.cpp 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "core_jni_helpers.h" #include <cputimeinstate.h> namespace android { static jboolean KernelCpuBpfTracking_isSupported(JNIEnv *, jobject) { return android::bpf::isTrackingUidTimesSupported() ? JNI_TRUE : JNI_FALSE; } static const JNINativeMethod methods[] = { {"isSupported", "()Z", (void *)KernelCpuBpfTracking_isSupported}, }; int register_com_android_internal_os_KernelCpuBpfTracking(JNIEnv *env) { return RegisterMethodsOrDie(env, "com/android/internal/os/KernelCpuBpfTracking", methods, NELEM(methods)); } } // namespace android Loading
core/java/com/android/internal/os/KernelCpuBpfTracking.java 0 → 100644 +26 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ package com.android.internal.os; /** CPU tracking using eBPF. */ public final class KernelCpuBpfTracking { private KernelCpuBpfTracking() { } /** Returns whether CPU tracking using eBPF is supported. */ public static native boolean isSupported(); }
core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java +0 −3 Original line number Diff line number Diff line Loading @@ -23,9 +23,6 @@ public final class KernelCpuTotalBpfMapReader { private KernelCpuTotalBpfMapReader() { } /** Returns whether total CPU time is measured. */ public static native boolean isSupported(); /** Reads total CPU time from bpf map. */ public static native boolean read(Callback callback); Loading
core/jni/Android.bp +1 −0 Original line number Diff line number Diff line Loading @@ -184,6 +184,7 @@ cc_library_shared { "com_android_internal_net_NetworkUtilsInternal.cpp", "com_android_internal_os_ClassLoaderFactory.cpp", "com_android_internal_os_FuseAppLoop.cpp", "com_android_internal_os_KernelCpuBpfTracking.cpp", "com_android_internal_os_KernelCpuTotalBpfMapReader.cpp", "com_android_internal_os_KernelCpuUidBpfMapReader.cpp", "com_android_internal_os_KernelSingleProcessCpuThreadReader.cpp", Loading
core/jni/AndroidRuntime.cpp +2 −0 Original line number Diff line number Diff line Loading @@ -190,6 +190,7 @@ extern int register_com_android_internal_content_om_OverlayConfig(JNIEnv *env); extern int register_com_android_internal_net_NetworkUtilsInternal(JNIEnv* env); extern int register_com_android_internal_os_ClassLoaderFactory(JNIEnv* env); extern int register_com_android_internal_os_FuseAppLoop(JNIEnv* env); extern int register_com_android_internal_os_KernelCpuBpfTracking(JNIEnv* env); extern int register_com_android_internal_os_KernelCpuTotalBpfMapReader(JNIEnv* env); extern int register_com_android_internal_os_KernelCpuUidBpfMapReader(JNIEnv *env); extern int register_com_android_internal_os_KernelSingleProcessCpuThreadReader(JNIEnv* env); Loading Loading @@ -1586,6 +1587,7 @@ static const RegJNIRec gRegJNI[] = { REG_JNI(register_android_security_Scrypt), REG_JNI(register_com_android_internal_content_NativeLibraryHelper), REG_JNI(register_com_android_internal_os_FuseAppLoop), REG_JNI(register_com_android_internal_os_KernelCpuBpfTracking), REG_JNI(register_com_android_internal_os_KernelCpuTotalBpfMapReader), REG_JNI(register_com_android_internal_os_KernelCpuUidBpfMapReader), REG_JNI(register_com_android_internal_os_KernelSingleProcessCpuThreadReader), Loading
core/jni/com_android_internal_os_KernelCpuBpfTracking.cpp 0 → 100644 +36 −0 Original line number Diff line number Diff line /* * Copyright (C) 2021 The Android Open Source Project * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ #include "core_jni_helpers.h" #include <cputimeinstate.h> namespace android { static jboolean KernelCpuBpfTracking_isSupported(JNIEnv *, jobject) { return android::bpf::isTrackingUidTimesSupported() ? JNI_TRUE : JNI_FALSE; } static const JNINativeMethod methods[] = { {"isSupported", "()Z", (void *)KernelCpuBpfTracking_isSupported}, }; int register_com_android_internal_os_KernelCpuBpfTracking(JNIEnv *env) { return RegisterMethodsOrDie(env, "com/android/internal/os/KernelCpuBpfTracking", methods, NELEM(methods)); } } // namespace android