Test CpuCyclesPerThreadGroupCluster atom
This is a basic test that pulling this atom succeeds.
Bug: 173227907
Test: atest CpuStatsTests
Change-Id: I5629561fe79887cab38115afe773f057114c6901
diff --git a/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java b/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java
index 73f3f98..b3ac62c 100644
--- a/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java
+++ b/hostsidetests/statsdatom/src/android/cts/statsdatom/cpu/CpuStatsTests.java
@@ -94,6 +94,7 @@
AtomTestUtils.sendAppBreadcrumbReportedAtom(getDevice());
Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+ // The list of atoms will be empty if the atom is not supported.
List<AtomsProto.Atom> atoms = ReportUtils.getGaugeMetricAtoms(getDevice());
for (AtomsProto.Atom atom : atoms) {
@@ -114,6 +115,7 @@
AtomTestUtils.sendAppBreadcrumbReportedAtom(getDevice());
Thread.sleep(AtomTestUtils.WAIT_TIME_LONG);
+ // The list of atoms will be empty if the atom is not supported.
List<AtomsProto.Atom> atoms = ReportUtils.getGaugeMetricAtoms(getDevice());
for (AtomsProto.Atom atom : atoms) {
@@ -124,4 +126,27 @@
assertThat(atom.getCpuCyclesPerUidCluster().getPowerProfileEstimate()).isAtLeast(0);
}
}
+
+ public void testCpuCyclesPerThreadGroupCluster() throws Exception {
+ ConfigUtils.uploadConfigForPulledAtom(getDevice(), DeviceUtils.STATSD_ATOM_TEST_PKG,
+ AtomsProto.Atom.CPU_CYCLES_PER_THREAD_GROUP_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);
+
+ // The list of atoms will be empty if the atom is not supported.
+ List<AtomsProto.Atom> atoms = ReportUtils.getGaugeMetricAtoms(getDevice());
+
+ for (AtomsProto.Atom atom : atoms) {
+ assertThat(atom.getCpuCyclesPerThreadGroupCluster().getThreadGroup()).isNotEqualTo(
+ AtomsProto.CpuCyclesPerThreadGroupCluster.ThreadGroup.UNKNOWN_THREAD_GROUP);
+ assertThat(atom.getCpuCyclesPerThreadGroupCluster().getCluster()).isAtLeast(0);
+ assertThat(atom.getCpuCyclesPerThreadGroupCluster().getMcycles()).isAtLeast(0);
+ assertThat(atom.getCpuCyclesPerThreadGroupCluster().getTimeMillis()).isAtLeast(0);
+ }
+ }
}