Test new fields in GRAPHICSSTATS
Test for pipeline type and GPU histogram presence in GRAPHICSSTATS
proto.
Test: this
Bug: 137939731
Change-Id: Idbbca0140d1e26d6dde90f1210100f3cf3dc0167
diff --git a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
index 1356600..ea1f803 100644
--- a/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
+++ b/hostsidetests/incident/src/com/android/server/cts/GraphicsStatsValidationTest.java
@@ -107,6 +107,8 @@
int veryJankyDelta = countFramesAbove(statsAfter, 60) - countFramesAbove(statsBefore, 60);
// The 1st frame could be >40ms, but nothing after that should be
assertTrue(veryJankyDelta <= 2);
+ int noGPUJank = countGPUFramesAbove(statsAfter, 60) - countGPUFramesAbove(statsBefore, 60);
+ assertTrue(noGPUJank == 0);
}
public void testDaveyDrawFrame() throws Exception {
@@ -181,6 +183,9 @@
assertTrue(summary.getSlowBitmapUploadCount() <= summary.getJankyFrames());
assertTrue(summary.getSlowDrawCount() <= summary.getJankyFrames());
assertTrue(proto.getHistogramCount() > 0);
+ assertTrue(proto.getGpuHistogramCount() > 0);
+ assertTrue(proto.getPipeline() == GraphicsStatsProto.PipelineType.GL
+ || proto.getPipeline() == GraphicsStatsProto.PipelineType.VULKAN);
int histogramTotal = countTotalFrames(proto);
assertEquals(summary.getTotalFrames(), histogramTotal);
@@ -196,6 +201,16 @@
return totalFrames;
}
+ private int countGPUFramesAbove(GraphicsStatsProto proto, int thresholdMs) {
+ int totalFrames = 0;
+ for (GraphicsStatsHistogramBucketProto bucket : proto.getGpuHistogramList()) {
+ if (bucket.getRenderMillis() >= thresholdMs) {
+ totalFrames += bucket.getFrameCount();
+ }
+ }
+ return totalFrames;
+ }
+
private int countTotalFrames(GraphicsStatsProto proto) {
return countFramesAbove(proto, 0);
}