Пример #1
0
  def GetOSVersionName(self):
    os_version = platform.uname()[3]

    if os_version.startswith('5.1.'):
      return platform_backend.OSVersion('xp', 5.1)
    if os_version.startswith('6.0.'):
      return platform_backend.OSVersion('vista', 6.0)
    if os_version.startswith('6.1.'):
      return platform_backend.OSVersion('win7', 6.1)
    if os_version.startswith('6.2.'):
      return platform_backend.OSVersion('win8', 6.2)

    raise NotImplementedError('Unknown win version %s.' % os_version)
    def GetOSVersionName(self):
        if not os.path.exists('/etc/lsb-release'):
            raise NotImplementedError('Unknown Linux OS version')

        codename = None
        version = None
        for line in open('/etc/lsb-release', 'r').readlines():
            key, _, value = line.partition('=')
            if key == 'DISTRIB_CODENAME':
                codename = value.strip()
            elif key == 'DISTRIB_RELEASE':
                version = float(value)
            if codename and version:
                break
        return platform_backend.OSVersion(codename, version)
Пример #3
0
# found in the LICENSE file.

import ctypes
import os
import time
try:
    import resource  # pylint: disable=F0401
except ImportError:
    resource = None  # Not available on all platforms

from telemetry import decorators
from telemetry.core.platform import platform_backend
from telemetry.core.platform import posix_platform_backend
from telemetry.core.platform.power_monitor import powermetrics_power_monitor

LEOPARD = platform_backend.OSVersion('leopard', 10.5)
SNOWLEOPARD = platform_backend.OSVersion('snowleopard', 10.6)
LION = platform_backend.OSVersion('lion', 10.7)
MOUNTAINLION = platform_backend.OSVersion('mountainlion', 10.8)
MAVERICKS = platform_backend.OSVersion('mavericks', 10.9)


class MacPlatformBackend(posix_platform_backend.PosixPlatformBackend):
    def __init__(self):
        super(MacPlatformBackend, self).__init__()
        self.libproc = None
        self.power_monitor_ = powermetrics_power_monitor.PowerMetricsPowerMonitor(
            self)

    def StartRawDisplayFrameRateMeasurement(self):
        raise NotImplementedError()