diff options
author | dtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-16 05:48:02 +0000 |
---|---|---|
committer | dtu@chromium.org <dtu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-10-16 05:48:02 +0000 |
commit | f454eed0f7ead2959c249da24f6b0e6e69bbe832 (patch) | |
tree | 0c7992080726f1e338475d88f4863da064c365bd /tools | |
parent | ebc6f0ab551100dca9d3a5fc142e8ce8a4dac9c7 (diff) | |
download | chromium_src-f454eed0f7ead2959c249da24f6b0e6e69bbe832.zip chromium_src-f454eed0f7ead2959c249da24f6b0e6e69bbe832.tar.gz chromium_src-f454eed0f7ead2959c249da24f6b0e6e69bbe832.tar.bz2 |
[telemetry] Print graphics feature status.
Moved GetFeatureStatus() from the gpu_internals_ui to compositor_util, so we can add it to the existing SystemInfo.getInfo API. This exposes the top three sections of the chrome://gpu page through DevTools to Telemetry.
BUG=296773
TEST=TBD
Review URL: https://codereview.chromium.org/24828002
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@228870 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools')
-rw-r--r-- | tools/telemetry/telemetry/core/camel_case.py | 2 | ||||
-rw-r--r-- | tools/telemetry/telemetry/core/camel_case_unittest.py | 8 | ||||
-rw-r--r-- | tools/telemetry/telemetry/core/gpu_device.py | 4 | ||||
-rw-r--r-- | tools/telemetry/telemetry/core/gpu_info.py | 52 | ||||
-rw-r--r-- | tools/telemetry/telemetry/page/page_runner.py | 13 |
5 files changed, 45 insertions, 34 deletions
diff --git a/tools/telemetry/telemetry/core/camel_case.py b/tools/telemetry/telemetry/core/camel_case.py index 4c2939b..9a76890 100644 --- a/tools/telemetry/telemetry/core/camel_case.py +++ b/tools/telemetry/telemetry/core/camel_case.py @@ -27,4 +27,4 @@ def ToUnderscore(obj): return output else: - raise NotImplementedError() + return obj diff --git a/tools/telemetry/telemetry/core/camel_case_unittest.py b/tools/telemetry/telemetry/core/camel_case_unittest.py index 81df388..0714d3c 100644 --- a/tools/telemetry/telemetry/core/camel_case_unittest.py +++ b/tools/telemetry/telemetry/core/camel_case_unittest.py @@ -18,7 +18,7 @@ class CamelCaseTest(unittest.TestCase): def testList(self): camel_case_list = ['CamelCase', ['NestedList']] underscore_list = ['camel_case', ['nested_list']] - self.assertEquals(camel_case.ToUnderscore(camel_case_list), underscore_list) + self.assertEqual(camel_case.ToUnderscore(camel_case_list), underscore_list) def testDict(self): camel_case_dict = { @@ -43,9 +43,7 @@ class CamelCaseTest(unittest.TestCase): 'vendor_string': 'k', 'device_string': 'l' } ] } - self.assertEquals(camel_case.ToUnderscore(camel_case_dict), underscore_dict) + self.assertEqual(camel_case.ToUnderscore(camel_case_dict), underscore_dict) def testOther(self): - self.assertRaises( - NotImplementedError, - lambda: camel_case.ToUnderscore(lambda: None)) + self.assertEqual(camel_case.ToUnderscore(self), self) diff --git a/tools/telemetry/telemetry/core/gpu_device.py b/tools/telemetry/telemetry/core/gpu_device.py index 6ae1c27..926f927 100644 --- a/tools/telemetry/telemetry/core/gpu_device.py +++ b/tools/telemetry/telemetry/core/gpu_device.py @@ -46,8 +46,8 @@ class GPUDevice(object): Raises an exception if any attributes are missing. """ - return cls(attrs["vendor_id"], attrs["device_id"], - attrs["vendor_string"], attrs["device_string"]) + return cls(attrs['vendor_id'], attrs['device_id'], + attrs['vendor_string'], attrs['device_string']) @property def vendor_id(self): diff --git a/tools/telemetry/telemetry/core/gpu_info.py b/tools/telemetry/telemetry/core/gpu_info.py index 86f9803..cc7d742 100644 --- a/tools/telemetry/telemetry/core/gpu_info.py +++ b/tools/telemetry/telemetry/core/gpu_info.py @@ -1,50 +1,58 @@ # Copyright 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): + def __init__(self, device_array, aux_attributes, feature_status): if device_array == None: - raise Exception("Missing required 'devices' property") + raise Exception('Missing required "devices" property') if len(device_array) == 0: - raise Exception("Missing at least one GPU in device_array") + 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 + self._feature_status = feature_status @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) + 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")) + return cls(attrs['devices'], + attrs.get('aux_attributes'), attrs.get('feature_status')) @property def devices(self): - "An array of GPUDevices. Element 0 is the primary GPU on the system." + """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) + """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 + + @property + def feature_status(self): + """Returns an optional dictionary of graphics features and their status.""" + return self._feature_status diff --git a/tools/telemetry/telemetry/page/page_runner.py b/tools/telemetry/telemetry/page/page_runner.py index 9fcf8af..91ea615 100644 --- a/tools/telemetry/telemetry/page/page_runner.py +++ b/tools/telemetry/telemetry/page/page_runner.py @@ -57,10 +57,15 @@ class _RunState(object): logging.info('Model: %s' % system_info.model_name) if system_info.gpu: for i, device in enumerate(system_info.gpu.devices): - logging.info('GPU device %d: %s' % (i, device)) - logging.info('GPU Attributes:') - for k, v in system_info.gpu.aux_attributes.iteritems(): - logging.info('\t%s: %s' % (k, v)) + logging.info('GPU device %d: %s', i, device) + if system_info.gpu.aux_attributes: + logging.info('GPU Attributes:') + for k, v in sorted(system_info.gpu.aux_attributes.iteritems()): + logging.info(' %-20s: %s', k, v) + if system_info.gpu.feature_status: + logging.info('Feature Status:') + for k, v in sorted(system_info.gpu.feature_status.iteritems()): + logging.info(' %-20s: %s', k, v) else: logging.info('No GPU devices') |