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

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: Addressed pfeldman's feedback. Added SystemInfo, simplified, fixed bugs in protocol implementation.… 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..38fdb842ee3b0c22d6b016ed8a206f1b36505670
--- /dev/null
+++ b/tools/telemetry/telemetry/core/gpu_info.py
@@ -0,0 +1,58 @@
+# 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.
+
+ This class guarantees the following properties to be available:
+
+ gpus (array of type GPUDevice): the GPUs on the system. Element
+ 0 is the primary GPU.
+
+ Consult the documentation for the individual properties for
+ more details."""
+
+ def __init__(self, gpus_array, aux_attributes):
+ if gpus_array == None:
+ raise Exception("Missing required 'gpus' property")
+ if len(gpus_array) == 0:
+ raise Exception("Missing at least one GPU in gpus_array")
+
+ self._gpus = [gpu_device.GPUDevice.FromDict(d) for d in gpus_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:
+
+ gpus (array of dictionaries, each of which contains
+ GPUDevice's required attributes)
+ """
+ return cls(attrs["gpus"], attrs.get("aux_attributes"))
+
+ @property
+ def gpus(self):
+ "An array of GPUDevices. Element 0 is the primary GPU on the system."
+ return self._gpus
+
+ @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