Test CpuCyclesPerUidCluster atom
This is a basic test that pulling this atom succeeds.
Bug: 176066876
Test: atest CpuStatsTests
Change-Id: I62b4198b205ec0d8c2ceedbacf28b89b4facaa59
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java
index 388bae5..73f3f98 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java
@@ -102,4 +102,26 @@
assertThat(atom.getCpuTimePerClusterFreq().getTimeMillis()).isAtLeast(0);
}
}
+
+ public void testCpuCyclesPerUidCluster() throws Exception {
+ ConfigUtils.uploadConfigForPulledAtom(getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
+ AtomsProto.Atom.CPU_CYCLES_PER_UID_CLUSTER_FIELD_NUMBER);
+
+ // Do some trivial work on the app
+ DeviceUtils.runDeviceTestsOnStatsdApp(getDevice(), ".AtomTests", "testSimpleCpu");
+ Thread.sleep(AtomTestUtils.WAIT_TIME_SHORT);
+ // Trigger atom pull
+ AtomTestUtils.sendAppBreadcrumbReportedAtom(getDevice());
+ Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+
+ List<AtomsProto.Atom> atoms = ReportUtils.getGaugeMetricAtoms(getDevice());
+
+ for (AtomsProto.Atom atom : atoms) {
+ assertThat(atom.getCpuCyclesPerUidCluster().getUid()).isAtLeast(0);
+ assertThat(atom.getCpuCyclesPerUidCluster().getCluster()).isAtLeast(0);
+ assertThat(atom.getCpuCyclesPerUidCluster().getMcycles()).isAtLeast(0);
+ assertThat(atom.getCpuCyclesPerUidCluster().getTimeMillis()).isAtLeast(0);
+ assertThat(atom.getCpuCyclesPerUidCluster().getPowerProfileEstimate()).isAtLeast(0);
+ }
+ }
}