Merge "Use the module bpf_syscall_wrappers for BPF system calls"
diff --git a/libbpf_android/BpfLoadTest.cpp b/libbpf_android/BpfLoadTest.cpp
index b384c11..09cd36c 100644
--- a/libbpf_android/BpfLoadTest.cpp
+++ b/libbpf_android/BpfLoadTest.cpp
@@ -38,8 +38,6 @@
     int mProgFd;
 
     void SetUp() {
-        SKIP_IF_BPF_NOT_SUPPORTED;
-
         unlink(tp_prog_path);
         unlink(tp_map_path);
 
@@ -55,8 +53,6 @@
     }
 
     void TearDown() {
-        SKIP_IF_BPF_NOT_SUPPORTED;
-
         close(mProgFd);
         unlink(tp_prog_path);
         unlink(tp_map_path);
@@ -88,8 +84,6 @@
 };
 
 TEST_F(BpfLoadTest, bpfCheckMap) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     checkMapNonZero();
 }
 
diff --git a/libbpf_android/BpfMapTest.cpp b/libbpf_android/BpfMapTest.cpp
index 91b9bf3..d0737b0 100644
--- a/libbpf_android/BpfMapTest.cpp
+++ b/libbpf_android/BpfMapTest.cpp
@@ -54,8 +54,6 @@
     BpfMapTest() {}
 
     void SetUp() {
-        SKIP_IF_BPF_NOT_SUPPORTED;
-
         EXPECT_EQ(0, setrlimitForTest());
         if (!access(PINNED_MAP_PATH, R_OK)) {
             EXPECT_EQ(0, remove(PINNED_MAP_PATH));
@@ -63,8 +61,6 @@
     }
 
     void TearDown() {
-        SKIP_IF_BPF_NOT_SUPPORTED;
-
         if (!access(PINNED_MAP_PATH, R_OK)) {
             EXPECT_EQ(0, remove(PINNED_MAP_PATH));
         }
@@ -107,8 +103,6 @@
 };
 
 TEST_F(BpfMapTest, constructor) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap1;
     checkMapInvalid(testMap1);
 
@@ -117,8 +111,6 @@
 }
 
 TEST_F(BpfMapTest, basicHelpers) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     uint32_t key = TEST_KEY1;
     uint32_t value_write = TEST_VALUE1;
@@ -133,8 +125,6 @@
 }
 
 TEST_F(BpfMapTest, reset) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     uint32_t key = TEST_KEY1;
     uint32_t value_write = TEST_VALUE1;
@@ -147,8 +137,6 @@
 }
 
 TEST_F(BpfMapTest, moveConstructor) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap1(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     BpfMap<uint32_t, uint32_t> testMap2;
     testMap2 = std::move(testMap1);
@@ -159,8 +147,6 @@
 }
 
 TEST_F(BpfMapTest, SetUpMap) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     EXPECT_NE(0, access(PINNED_MAP_PATH, R_OK));
     BpfMap<uint32_t, uint32_t> testMap1(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     ASSERT_EQ(0, bpfFdPin(testMap1.getMap(), PINNED_MAP_PATH));
@@ -177,8 +163,6 @@
 }
 
 TEST_F(BpfMapTest, iterate) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     populateMap(TEST_MAP_SIZE, testMap);
     int totalCount = 0;
@@ -197,8 +181,6 @@
 }
 
 TEST_F(BpfMapTest, iterateWithValue) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     populateMap(TEST_MAP_SIZE, testMap);
     int totalCount = 0;
@@ -219,8 +201,6 @@
 }
 
 TEST_F(BpfMapTest, mapIsEmpty) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     expectMapEmpty(testMap);
     uint32_t key = TEST_KEY1;
@@ -251,8 +231,6 @@
 }
 
 TEST_F(BpfMapTest, mapClear) {
-    SKIP_IF_BPF_NOT_SUPPORTED;
-
     BpfMap<uint32_t, uint32_t> testMap(BPF_MAP_TYPE_HASH, TEST_MAP_SIZE, BPF_F_NO_PREALLOC);
     populateMap(TEST_MAP_SIZE, testMap);
     Result<bool> isEmpty = testMap.isEmpty();
diff --git a/progs/include/bpf_timeinstate.h b/progs/include/bpf_timeinstate.h
index 7cb7baa..1065b6e 100644
--- a/progs/include/bpf_timeinstate.h
+++ b/progs/include/bpf_timeinstate.h
@@ -19,6 +19,10 @@
 
 #define BPF_FS_PATH "/sys/fs/bpf/"
 
+// Number of frequencies tracked in the array with total time. If some CPUs have
+// more than 64 freqs
+// // available, the overflow is stored in the last entry.
+#define MAX_FREQS_FOR_TOTAL 64
 // Number of frequencies for which a UID's times can be tracked in a single map entry. If some CPUs
 // have more than 32 freqs available, a single UID is tracked using 2 or more entries.
 #define FREQS_PER_ENTRY 32