GpuStats: add render api versions to global stats
Bug: 131866357
Test: atest GpuStatsPuller_test
Change-Id: I7875c3dd7935297519d68cd1d16277928ab2e53b
diff --git a/cmds/statsd/src/atoms.proto b/cmds/statsd/src/atoms.proto
index 318d90c..baa8402 100644
--- a/cmds/statsd/src/atoms.proto
+++ b/cmds/statsd/src/atoms.proto
@@ -5966,6 +5966,15 @@
// Total count of the Vulkan driver fails to be loaded.
optional int64 vk_loading_failure_count = 8;
+
+ // Api version of the system Vulkan driver.
+ optional int32 vulkan_version = 9;
+
+ // Api version of the system CPU Vulkan driver.
+ optional int32 cpu_vulkan_version = 10;
+
+ // Api version of the system GLES driver.
+ optional int32 gles_version = 11;
}
/**
diff --git a/cmds/statsd/src/external/GpuStatsPuller.cpp b/cmds/statsd/src/external/GpuStatsPuller.cpp
index 3fa932f..876383c 100644
--- a/cmds/statsd/src/external/GpuStatsPuller.cpp
+++ b/cmds/statsd/src/external/GpuStatsPuller.cpp
@@ -65,6 +65,9 @@
if (!event->write((int64_t)info.glLoadingFailureCount)) return false;
if (!event->write((int64_t)info.vkLoadingCount)) return false;
if (!event->write((int64_t)info.vkLoadingFailureCount)) return false;
+ if (!event->write(info.vulkanVersion)) return false;
+ if (!event->write(info.cpuVulkanVersion)) return false;
+ if (!event->write(info.glesVersion)) 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 8625487..2acfb83 100644
--- a/cmds/statsd/tests/external/GpuStatsPuller_test.cpp
+++ b/cmds/statsd/tests/external/GpuStatsPuller_test.cpp
@@ -48,7 +48,10 @@
static const int64_t VK_DRIVER_LOADING_TIME_0 = 777;
static const int64_t VK_DRIVER_LOADING_TIME_1 = 888;
static const int64_t VK_DRIVER_LOADING_TIME_2 = 999;
-static const size_t NUMBER_OF_VALUES_GLOBAL = 8;
+static const int32_t VULKAN_VERSION = 1;
+static const int32_t CPU_VULKAN_VERSION = 2;
+static const int32_t GLES_VERSION = 3;
+static const size_t NUMBER_OF_VALUES_GLOBAL = 11;
static const size_t NUMBER_OF_VALUES_APP = 4;
// clang-format on
@@ -93,6 +96,9 @@
EXPECT_TRUE(event->write(GL_LOADING_FAILURE_COUNT));
EXPECT_TRUE(event->write(VK_LOADING_COUNT));
EXPECT_TRUE(event->write(VK_LOADING_FAILURE_COUNT));
+ EXPECT_TRUE(event->write(VULKAN_VERSION));
+ EXPECT_TRUE(event->write(CPU_VULKAN_VERSION));
+ EXPECT_TRUE(event->write(GLES_VERSION));
event->init();
inData.emplace_back(event);
MockGpuStatsPuller mockPuller(android::util::GPU_STATS_GLOBAL_INFO, &inData);
@@ -110,6 +116,9 @@
EXPECT_EQ(GL_LOADING_FAILURE_COUNT, outData[0]->getValues()[5].mValue.long_value);
EXPECT_EQ(VK_LOADING_COUNT, outData[0]->getValues()[6].mValue.long_value);
EXPECT_EQ(VK_LOADING_FAILURE_COUNT, outData[0]->getValues()[7].mValue.long_value);
+ EXPECT_EQ(VULKAN_VERSION, outData[0]->getValues()[8].mValue.int_value);
+ EXPECT_EQ(CPU_VULKAN_VERSION, outData[0]->getValues()[9].mValue.int_value);
+ EXPECT_EQ(GLES_VERSION, outData[0]->getValues()[10].mValue.int_value);
}
TEST_F(GpuStatsPuller_test, PullGpuStatsAppInfo) {