GpuStats: track whether the app creates ES1 context
Bug: 146661131
Test: atest statsd_test:GpuStatsPuller_test
Change-Id: If2acabfca38fad08d4245c2bac643ca5fc87c1d7
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 2efb789..3ccdf7e 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -6667,6 +6667,9 @@
// App is not doing pre-rotation correctly.
optional bool false_prerotation = 7;
+
+ // App creates GLESv1 context.
+ optional bool gles_1_in_use = 8;
}
/*
diff --git a/cmds/statsd/src/external/GpuStatsPuller.cpp b/cmds/statsd/src/external/GpuStatsPuller.cpp
index d38b87f..3229ba8 100644
--- a/cmds/statsd/src/external/GpuStatsPuller.cpp
+++ b/cmds/statsd/src/external/GpuStatsPuller.cpp
@@ -103,6 +103,7 @@
}
if (!event->write(info.cpuVulkanInUse)) return false;
if (!event->write(info.falsePrerotation)) return false;
+ if (!event->write(info.gles1InUse)) return false;
event->init();
data->emplace_back(event);
}
diff --git a/cmds/statsd/tests/external/GpuStatsPuller_test.cpp b/cmds/statsd/tests/external/GpuStatsPuller_test.cpp
index e91fb0d..9e29611 100644
--- a/cmds/statsd/tests/external/GpuStatsPuller_test.cpp
+++ b/cmds/statsd/tests/external/GpuStatsPuller_test.cpp
@@ -57,8 +57,9 @@
static const int32_t GLES_VERSION = 3;
static const bool CPU_VULKAN_IN_USE = true;
static const bool FALSE_PREROTATION = true;
+static const bool GLES_1_IN_USE = true;
static const size_t NUMBER_OF_VALUES_GLOBAL = 13;
-static const size_t NUMBER_OF_VALUES_APP = 7;
+static const size_t NUMBER_OF_VALUES_APP = 8;
// clang-format on
class MockGpuStatsPuller : public GpuStatsPuller {
@@ -152,6 +153,7 @@
EXPECT_TRUE(event->write(int64VectorToProtoByteString(angleDriverLoadingTime)));
EXPECT_TRUE(event->write(CPU_VULKAN_IN_USE));
EXPECT_TRUE(event->write(FALSE_PREROTATION));
+ EXPECT_TRUE(event->write(GLES_1_IN_USE));
event->init();
inData.emplace_back(event);
MockGpuStatsPuller mockPuller(android::util::GPU_STATS_APP_INFO, &inData);
@@ -171,6 +173,7 @@
outData[0]->getValues()[4].mValue.str_value);
EXPECT_EQ(CPU_VULKAN_IN_USE, outData[0]->getValues()[5].mValue.int_value);
EXPECT_EQ(FALSE_PREROTATION, outData[0]->getValues()[6].mValue.int_value);
+ EXPECT_EQ(GLES_1_IN_USE, outData[0]->getValues()[7].mValue.int_value);
}
} // namespace statsd