| OLD | NEW |
| 1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 from telemetry.internal.platform import gpu_info | 4 from telemetry.internal.platform import gpu_info |
| 5 | 5 |
| 6 | 6 |
| 7 class SystemInfo(object): | 7 class SystemInfo(object): |
| 8 """Provides low-level system information.""" | 8 """Provides low-level system information.""" |
| 9 | 9 |
| 10 def __init__(self, model_name, gpu_dict): | 10 def __init__(self, model_name, gpu_dict, command_line): |
| 11 if (model_name == None) or (gpu_dict == None): | 11 if (model_name == None) or (gpu_dict == None): |
| 12 raise Exception("Missing model_name or gpu_dict argument") | 12 raise Exception("Missing model_name or gpu_dict argument") |
| 13 self._model_name = model_name | 13 self._model_name = model_name |
| 14 self._gpu = gpu_info.GPUInfo.FromDict(gpu_dict) | 14 self._gpu = gpu_info.GPUInfo.FromDict(gpu_dict) |
| 15 self._command_line = command_line |
| 15 | 16 |
| 16 @classmethod | 17 @classmethod |
| 17 def FromDict(cls, attrs): | 18 def FromDict(cls, attrs): |
| 18 """Constructs a SystemInfo from a dictionary of attributes. | 19 """Constructs a SystemInfo from a dictionary of attributes. |
| 19 Attributes currently required to be present in the dictionary: | 20 Attributes currently required to be present in the dictionary: |
| 20 | 21 |
| 21 model_name (string): a platform-dependent string | 22 model_name (string): a platform-dependent string |
| 22 describing the model of machine, or the empty string if not | 23 describing the model of machine, or the empty string if not |
| 23 supported. | 24 supported. |
| 24 gpu (object containing GPUInfo's required attributes) | 25 gpu (object containing GPUInfo's required attributes) |
| 25 """ | 26 """ |
| 26 model_name = attrs["model_name"] | 27 model_name = attrs["model_name"] |
| 27 model_version = attrs.get('model_version', '') | 28 model_version = attrs.get('model_version', '') |
| 28 if model_name and model_version: | 29 if model_name and model_version: |
| 29 model_name += ' ' + model_version | 30 model_name += ' ' + model_version |
| 30 return cls(model_name, attrs["gpu"]) | 31 return cls(model_name, attrs["gpu"], attrs.get('command_line', '')) |
| 31 | 32 |
| 32 @property | 33 @property |
| 33 def model_name(self): | 34 def model_name(self): |
| 34 """A string describing the machine model. | 35 """A string describing the machine model. |
| 35 | 36 |
| 36 This is a highly platform-dependent value and not currently | 37 This is a highly platform-dependent value and not currently |
| 37 specified for any machine type aside from Macs. On Mac OS, this | 38 specified for any machine type aside from Macs. On Mac OS, this |
| 38 is the model identifier, reformatted slightly; for example, | 39 is the model identifier, reformatted slightly; for example, |
| 39 'MacBookPro 10.1'.""" | 40 'MacBookPro 10.1'.""" |
| 40 return self._model_name | 41 return self._model_name |
| 41 | 42 |
| 42 @property | 43 @property |
| 43 def gpu(self): | 44 def gpu(self): |
| 44 """A GPUInfo object describing the graphics processor(s) on the system.""" | 45 """A GPUInfo object describing the graphics processor(s) on the system.""" |
| 45 return self._gpu | 46 return self._gpu |
| 47 |
| 48 @property |
| 49 def command_line(self): |
| 50 """A string containing the command line used to launch the browser.""" |
| 51 return self._command_line |
| OLD | NEW |