Home | History | Annotate | Download | only in core
      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
      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, model_name, gpu_dict):
     10     if (model_name == None) or (gpu_dict == None):
     11       raise Exception("Missing model_name or gpu_dict argument")
     12     self._model_name = model_name
     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          model_name (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["model_name"], attrs["gpu"])
     26 
     27   @property
     28   def model_name(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._model_name
     36 
     37   @property
     38   def gpu(self):
     39     """A GPUInfo object describing the graphics processor(s) on the system."""
     40     return self._gpu
     41