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