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

Unified Diff: tools/telemetry/telemetry/core/gpu_info.py

Issue 21682002: Expose GPU information to Telemetry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Refactored more code into WebSocketBrowserConnection on nduca's request. 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: tools/telemetry/telemetry/core/gpu_info.py
diff --git a/tools/telemetry/telemetry/core/gpu_info.py b/tools/telemetry/telemetry/core/gpu_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..ffbb3fdef00ad9bdff8633261dadf209a261f572
--- /dev/null
+++ b/tools/telemetry/telemetry/core/gpu_info.py
@@ -0,0 +1,50 @@
+# Copyright (c) 2013 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+from telemetry.core import gpu_device
+
+class GPUInfo(object):
+ """Provides information about the GPUs on the system."""
+
+ def __init__(self, device_array, aux_attributes):
+ if device_array == None:
+ raise Exception("Missing required 'devices' property")
+ if len(device_array) == 0:
+ raise Exception("Missing at least one GPU in device_array")
+
+ self._devices = [gpu_device.GPUDevice.FromDict(d) for d in device_array]
+ self._aux_attributes = aux_attributes
+
+ @classmethod
+ def FromDict(cls, attrs):
+ """Constructs a GPUInfo from a dictionary of attributes.
+ Attributes currently required to be present in the dictionary:
+
+ devices (array of dictionaries, each of which contains
+ GPUDevice's required attributes)
+ """
+ return cls(attrs["devices"], attrs.get("aux_attributes"))
+
+ @property
+ def devices(self):
+ "An array of GPUDevices. Element 0 is the primary GPU on the system."
+ return self._devices
+
+ @property
+ def aux_attributes(self):
+ """Returns a dictionary of auxiliary, optional, attributes. On the
+ Chrome browser, for example, this dictionary contains:
+
+ optimus (boolean)
+ amd_switchable (boolean)
+ lenovo_dcute (boolean)
+ driver_vendor (string)
+ driver_version (string)
+ driver_date (string)
+ gl_version_string (string)
+ gl_vendor (string)
+ gl_renderer (string)
+ gl_extensions (string)
+ display_link_version (string)
+ """
+ return self._aux_attributes

Powered by Google App Engine
This is Rietveld 408576698