Commit d7e9662a by Jamie Madill Committed by Commit Bot

Print SystemInfo after collection in ANGLE tests.

Disabled on Android because of issues with test parsing. Bug: angleproject:2677 Change-Id: I75197e423f35bd8b84e27bb9b14d8c91779ad9c8 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/1537696 Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarYuly Novikov <ynovikov@chromium.org> Reviewed-by: 's avatarJonah Ryan-Davis <jonahr@google.com>
parent 0449a902
......@@ -9,6 +9,7 @@
#include "gpu_info_util/SystemInfo.h"
#include <cstring>
#include <iostream>
#include <sstream>
#include "common/debug.h"
......@@ -16,7 +17,33 @@
namespace angle
{
namespace
{
std::string VendorName(VendorID vendor)
{
switch (vendor)
{
case kVendorID_AMD:
return "AMD";
case kVendorID_Intel:
return "Intel";
case kVendorID_ImgTec:
return "ImgTec";
case kVendorID_NVIDIA:
return "NVIDIA";
case kVendorID_Qualcomm:
return "Qualcomm";
case kVendorID_Vivante:
return "Vivante";
case kVendorID_VeriSilicon:
return "VeriSilicon";
case kVendorID_Kazan:
return "Kazan";
default:
return "Unknown (" + std::to_string(vendor) + ")";
}
}
} // anonymous namespace
GPUDeviceInfo::GPUDeviceInfo() = default;
GPUDeviceInfo::~GPUDeviceInfo() = default;
......@@ -229,4 +256,55 @@ void FindPrimaryGPU(SystemInfo *info)
info->isAMDSwitchable = hasIntel && IsAMD(info->gpus[primary].vendorId);
}
void PrintSystemInfo(const SystemInfo &info)
{
std::cout << info.gpus.size() << " GPUs:\n";
for (size_t i = 0; i < info.gpus.size(); i++)
{
const auto &gpu = info.gpus[i];
std::cout << " " << i << " - " << VendorName(gpu.vendorId) << " device id: 0x" << std::hex
<< std::uppercase << gpu.deviceId << std::dec << "\n";
if (!gpu.driverVendor.empty())
{
std::cout << " Driver Vendor: " << gpu.driverVendor << "\n";
}
if (!gpu.driverVersion.empty())
{
std::cout << " Driver Version: " << gpu.driverVersion << "\n";
}
if (!gpu.driverDate.empty())
{
std::cout << " Driver Date: " << gpu.driverDate << "\n";
}
}
std::cout << "\n";
std::cout << "Active GPU: " << info.activeGPUIndex << "\n";
std::cout << "Primary GPU: " << info.primaryGPUIndex << "\n";
std::cout << "\n";
std::cout << "Optimus: " << (info.isOptimus ? "true" : "false") << "\n";
std::cout << "AMD Switchable: " << (info.isAMDSwitchable ? "true" : "false") << "\n";
std::cout << "\n";
if (!info.machineManufacturer.empty())
{
std::cout << "Machine Manufacturer: " << info.machineManufacturer << "\n";
}
if (!info.machineModelName.empty())
{
std::cout << "Machine Model: " << info.machineModelName << "\n";
}
if (!info.machineModelVersion.empty())
{
std::cout << "Machine Model Version: " << info.machineModelVersion << "\n";
}
if (!info.primaryDisplayDeviceId.empty())
{
std::cout << "Primary Display Device: " << info.primaryDisplayDeviceId << "\n";
}
std::cout << std::endl;
}
} // namespace angle
......@@ -110,6 +110,8 @@ bool IsQualcomm(VendorID vendorId);
bool IsVeriSilicon(VendorID vendorId);
bool IsVivante(VendorID vendorId);
// Dumps the system info to stdout.
void PrintSystemInfo(const SystemInfo &info);
} // namespace angle
#endif // GPU_INFO_UTIL_SYSTEM_INFO_H_
......@@ -78,6 +78,13 @@ SystemInfo *GetTestSystemInfo()
{
std::cerr << "Warning: incomplete system info collection.\n";
}
// Print complete system info when available.
// Seems to trip up Android test expectation parsing.
if (!IsAndroid())
{
PrintSystemInfo(*sSystemInfo);
}
}
return sSystemInfo;
}
......
......@@ -25,25 +25,6 @@ namespace
# define SYSTEM_INFO_IMPLEMENTED
#endif
#if defined(SYSTEM_INFO_IMPLEMENTED)
std::string VendorName(VendorID vendor)
{
switch (vendor)
{
case kVendorID_AMD:
return "AMD";
case kVendorID_Intel:
return "Intel";
case kVendorID_NVIDIA:
return "Nvidia";
case kVendorID_Qualcomm:
return "Qualcomm";
default:
return "Unknown (" + std::to_string(vendor) + ")";
}
}
#endif
// Prints the information gathered about the system
TEST(PrintSystemInfoTest, Print)
{
......@@ -53,48 +34,7 @@ TEST(PrintSystemInfoTest, Print)
ASSERT_TRUE(GetSystemInfo(&info));
ASSERT_GT(info.gpus.size(), 0u);
std::cout << info.gpus.size() << " GPUs:\n";
for (size_t i = 0; i < info.gpus.size(); i++)
{
const auto &gpu = info.gpus[i];
std::cout << " " << i << " - " << VendorName(gpu.vendorId) << " device " << gpu.deviceId
<< "\n";
if (!gpu.driverVendor.empty())
{
std::cout << " Driver Vendor: " << gpu.driverVendor << "\n";
}
if (!gpu.driverVersion.empty())
{
std::cout << " Driver Version: " << gpu.driverVersion << "\n";
}
if (!gpu.driverDate.empty())
{
std::cout << " Driver Date: " << gpu.driverDate << "\n";
}
}
std::cout << "\n";
std::cout << "Active GPU: " << info.activeGPUIndex << "\n";
std::cout << "Primary GPU: " << info.primaryGPUIndex << "\n";
std::cout << "\n";
std::cout << "Optimus: " << (info.isOptimus ? "true" : "false") << "\n";
std::cout << "AMD Switchable: " << (info.isAMDSwitchable ? "true" : "false") << "\n";
std::cout << "\n";
if (!info.machineModelName.empty() || !info.machineModelVersion.empty())
{
std::cout << "Machine Model: " << info.machineModelName << " version "
<< info.machineModelVersion << "\n";
}
if (!info.primaryDisplayDeviceId.empty())
{
std::cout << "Primary Display Device: " << info.primaryDisplayDeviceId << "\n";
}
std::cout << std::endl;
PrintSystemInfo(info);
#else
std::cerr << "GetSystemInfo not implemented, skipping" << std::endl;
#endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment