def setUp(self):
   self._config = tracing_config.TracingConfig()
   self._config.enable_cpu_trace = True
   if sys.platform.startswith('win'):
     self._desktop_backend = win_platform_backend.WinPlatformBackend()
   elif sys.platform.startswith('darwin'):
     self._desktop_backend = mac_platform_backend.MacPlatformBackend()
   else:
     self._desktop_backend = linux_platform_backend.LinuxPlatformBackend()
   self._agent = cpu_tracing_agent.CpuTracingAgent(self._desktop_backend)
示例#2
0
    def testMsrRuns(self):
        platform_backend = win_platform_backend.WinPlatformBackend()
        power_monitor = msr_power_monitor.MsrPowerMonitorWin(platform_backend)
        if not power_monitor.CanMonitorPower():
            logging.warning('Test not supported on this platform.')
            return

        power_monitor.StartMonitoringPower(None)
        time.sleep(0.01)
        statistics = power_monitor.StopMonitoringPower()

        self.assertEqual(statistics['identifier'], 'msr')
        self.assertIn('energy_consumption_mwh', statistics)
        self.assertGreater(statistics['energy_consumption_mwh'], 0)
 def testTypExpectationsTagsForLaptop(self):
     backend = win_platform_backend.WinPlatformBackend()
     with mock.patch.object(backend, 'GetPcSystemType', return_value='2'):
         tags = backend.GetTypExpectationsTags()
         self.assertIn('win-laptop', tags)