Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(185)

Unified Diff: gpu/config/gpu_info.cc

Issue 21682002: Expose GPU information to Telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Addressed pfeldman's and nduca's review feedback. Rebased. Retested. Created 7 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: gpu/config/gpu_info.cc
diff --git a/gpu/config/gpu_info.cc b/gpu/config/gpu_info.cc
index 827c76c17ce5ca06caf1600760056af42da3e4d7..e9ea270782e3bc9ba83fd8e0c070d7ea67b58dbb 100644
--- a/gpu/config/gpu_info.cc
+++ b/gpu/config/gpu_info.cc
@@ -27,4 +27,89 @@ GPUInfo::GPUInfo()
GPUInfo::~GPUInfo() { }
+void GPUInfo::EnumerateFields(Enumerator* enumerator) const {
+ struct GPUInfoKnownFields {
+ bool finalized;
+ base::TimeDelta initialization_time;
+ bool optimus;
+ bool amd_switchable;
+ bool lenovo_dcute;
+ Version display_link_version;
+ GPUDevice gpu;
+ std::vector<GPUDevice> secondary_gpus;
+ uint64 adapter_luid;
+ std::string driver_vendor;
+ std::string driver_version;
+ std::string driver_date;
+ std::string pixel_shader_version;
+ std::string vertex_shader_version;
+ std::string machine_model;
+ std::string gl_version;
+ std::string gl_version_string;
+ std::string gl_vendor;
+ std::string gl_renderer;
+ std::string gl_extensions;
+ std::string gl_ws_vendor;
+ std::string gl_ws_version;
+ std::string gl_ws_extensions;
+ uint32 gl_reset_notification_strategy;
+ bool can_lose_context;
+ GpuPerformanceStats performance_stats;
+ bool software_rendering;
+ bool sandboxed;
+#if defined(OS_WIN)
+ DxDiagNode dx_diagnostics;
+#endif
+ };
+
+ // If this assert fails then most likely something below needs to be updated.
+ // Note that this assert is only approximate. If a new field is added to
+ // GPUInfo which fits within the current padding then it will not be caught.
+ COMPILE_ASSERT(
+ sizeof(GPUInfo) == sizeof(GPUInfoKnownFields),
+ Fields_Have_Changed_In_GPUInfo_So_Update_Below);
+
+ // Note that we use the C++, and Python, naming convention for these
+ // fields. The final consumer of this information is Telemetry's Python
+ // classes, and using a consistent naming convention reduces the amount
+ // of code that must be written converting back and forth.
+ enumerator->AddBool("finalized", finalized);
+ enumerator->AddTimeDeltaInSecondsF("initializationTime",
+ initialization_time);
+ enumerator->AddBool("optimus", optimus);
+ enumerator->AddBool("amdSwitchable", amd_switchable);
+ enumerator->AddBool("lenovoDcute", lenovo_dcute);
+ if (display_link_version.IsValid()) {
+ enumerator->AddString("displayLinkVersion",
+ display_link_version.GetString());
+ }
+ enumerator->AddGPUDevice(gpu);
+ for (size_t ii = 0; ii < secondary_gpus.size(); ++ii) {
+ enumerator->AddGPUDevice(secondary_gpus[ii]);
+ }
+ enumerator->AddInt64("adapterLuid", adapter_luid);
+ enumerator->AddString("driverVendor", driver_vendor);
+ enumerator->AddString("driverVersion", driver_version);
+ enumerator->AddString("driverDate", driver_date);
+ enumerator->AddString("pixelShaderVersion", pixel_shader_version);
+ enumerator->AddString("vertexShaderVersion", vertex_shader_version);
+ enumerator->AddString("machineModel", machine_model);
+ enumerator->AddString("glVersion", gl_version);
+ enumerator->AddString("glVersionString", gl_version_string);
+ enumerator->AddString("glVendor", gl_vendor);
+ enumerator->AddString("glRenderer", gl_renderer);
+ enumerator->AddString("glExtensions", gl_extensions);
+ enumerator->AddString("glWsVendor", gl_ws_vendor);
+ enumerator->AddString("glWsVersion", gl_ws_version);
+ enumerator->AddString("glWsExtensions", gl_ws_extensions);
+ enumerator->AddInt(
+ "glResetNotificationStrategy",
+ static_cast<int>(gl_reset_notification_strategy));
+ enumerator->AddBool("can_lose_context", can_lose_context);
+ // TODO(kbr): add performance_stats.
+ enumerator->AddBool("softwareRendering", software_rendering);
+ enumerator->AddBool("sandboxed", sandboxed);
+ // TODO(kbr): add dx_diagnostics on Windows.
+}
+
} // namespace gpu

Powered by Google App Engine
This is Rietveld 408576698