summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorRafal Slawik <rslawik@google.com>2021-02-11 15:21:13 +0000
committerRafal Slawik <rslawik@google.com>2021-02-11 15:21:13 +0000
commit4574305a4a43cc9d41e072c80a30d56acb9aa525 (patch)
tree82d4897ac976dc16a90d40fcee79b4b8b5053d42 /core/java
parentbf03ae3b78e69f6260f05033883d3911b33a4e8c (diff)
Check CPU time_in_state from one place
Move the check whether CPU eBPF tracking is supported to one place to avoid repeating it in every reader. Bug: 179485697 Test: existing tests pass Change-Id: Id6d23614c3d1dde86b66de14bc09f5976f183625
Diffstat (limited to 'core/java')
-rw-r--r--core/java/com/android/internal/os/KernelCpuBpfTracking.java26
-rw-r--r--core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java3
2 files changed, 26 insertions, 3 deletions
diff --git a/core/java/com/android/internal/os/KernelCpuBpfTracking.java b/core/java/com/android/internal/os/KernelCpuBpfTracking.java
new file mode 100644
index 000000000000..28525478be05
--- /dev/null
+++ b/core/java/com/android/internal/os/KernelCpuBpfTracking.java
@@ -0,0 +1,26 @@
+/*
+ * 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();
+}
diff --git a/core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java b/core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java
index 50331e3338dc..06760e140de1 100644
--- a/core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java
+++ b/core/java/com/android/internal/os/KernelCpuTotalBpfMapReader.java
@@ -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);