Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(181)

Unified Diff: tools/telemetry/telemetry/core/platform/cros_sysfs_platform.py

Issue 509043002: [Telemetry] Combine SysfsPlatformBackend into LinuxBasedPlatformBackend. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: tools/telemetry/telemetry/core/platform/cros_sysfs_platform.py
diff --git a/tools/telemetry/telemetry/core/platform/cros_sysfs_platform.py b/tools/telemetry/telemetry/core/platform/cros_sysfs_platform.py
deleted file mode 100644
index ae2be47eebae344c39ad577727036dfac4c24ea8..0000000000000000000000000000000000000000
--- a/tools/telemetry/telemetry/core/platform/cros_sysfs_platform.py
+++ /dev/null
@@ -1,49 +0,0 @@
-# Copyright 2014 The Chromium Authors. All rights reserved.
-# Use of this source code is governed by a BSD-style license that can be
-# found in the LICENSE file.
-
-from telemetry.core.platform import sysfs_platform
-
-
-class CrosSysfsPlatform(sysfs_platform.SysfsPlatform):
- """A SysfsPlatform implementation to be used for ChromeOS devices."""
- def __init__(self, cri):
- """Constructor.
-
- Args:
- cri: Chrome interface.
- """
- super(CrosSysfsPlatform, self).__init__()
- self._cri = cri
-
- def RunShellCommand(self, command):
- return self._cri.RunCmdOnDevice(command.split())[0]
-
- @staticmethod
- def ParseStateSample(sample):
- sample_stats = {}
- for cpu in sample:
- values = sample[cpu].splitlines()
- # There are three values per state after excluding the single time value.
- num_states = (len(values) - 1) / 3
- names = values[:num_states]
- times = values[num_states:2 * num_states]
- latencies = values[2 * num_states:]
- # The last line in the sample contains the time.
- cstates = {'C0': int(values[-1]) * 10 ** 6}
- for i, state in enumerate(names):
- if names[i] == 'POLL' and not int(latencies[i]):
- # C0 state. Kernel stats aren't right, so calculate by
- # subtracting all other states from total time (using epoch
- # timer since we calculate differences in the end anyway).
- # NOTE: Only x86 lists C0 under cpuidle, ARM does not.
- continue
- cstates['C0'] -= int(times[i])
- if names[i] == '<null>':
- # Kernel race condition that can happen while a new C-state gets
- # added (e.g. AC->battery). Don't know the 'name' of the state
- # yet, but its 'time' would be 0 anyway.
- continue
- cstates[state] = int(times[i])
- sample_stats[cpu] = cstates
- return sample_stats

Powered by Google App Engine
This is Rietveld 408576698