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

Unified Diff: tools/telemetry/telemetry/core/system_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/system_info.py
diff --git a/tools/telemetry/telemetry/core/system_info.py b/tools/telemetry/telemetry/core/system_info.py
new file mode 100644
index 0000000000000000000000000000000000000000..2e667c3eaa39de00c9f3b313c6f8a7a512c31265
--- /dev/null
+++ b/tools/telemetry/telemetry/core/system_info.py
@@ -0,0 +1,40 @@
+# 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_info
+
+class SystemInfo(object):
+ """Provides low-level system information."""
+
+ def __init__(self, machine_model, gpu_dict):
+ if (machine_model == None) or (gpu_dict == None):
+ raise Exception("Missing machine_model or gpu_dict argument")
+ self._machine_model = machine_model
+ self._gpu = gpu_info.GPUInfo.FromDict(gpu_dict)
+
+ @classmethod
+ def FromDict(cls, attrs):
+ """Constructs a SystemInfo from a dictionary of attributes.
+ Attributes currently required to be present in the dictionary:
+
+ machine_model (string): a platform-dependent string
+ describing the model of machine, or the empty string if not
+ supported.
+ gpu (object containing GPUInfo's required attributes)
+ """
+ return cls(attrs["machine_model"], attrs["gpu"])
+
+ @property
+ def machine_model(self):
+ """A string describing the machine model.
+
+ This is a highly platform-dependent value and not currently
+ specified for any machine type aside from Macs. On Mac OS, this
+ is the model identifier, reformatted slightly; for example,
+ 'MacBookPro 10.1'."""
+ return self._machine_model
+
+ @property
+ def gpu(self):
+ """A GPUInfo object describing the graphics processor(s) on the system."""
+ return self._gpu

Powered by Google App Engine
This is Rietveld 408576698