Upstream version 10.38.222.0
[platform/framework/web/crosswalk.git] / src / tools / telemetry / telemetry / core / platform / power_monitor / sysfs_platform.py
1 # Copyright 2014 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
5 class SysfsPlatform(object):
6   """A platform-specific utility class for running shell commands and properly
7   gathering c-state data.
8   """
9   def RunShellCommand(self, command):
10     """Run command on this particular shell.
11
12     Args:
13         A command string to be executed in the shell.
14
15     Returns:
16         A string containing the results of the command.
17     """
18     raise NotImplementedError()
19
20   @staticmethod
21   def ParseStateSample(sample):
22     """Parse a single c-state residency sample.
23
24     Args:
25         sample: A sample of c-state residency times to be parsed. Organized as
26             a dictionary mapping CPU name to a string containing all c-state
27             names, the times in each state, the latency of each state, and the
28             time at which the sample was taken all separated by newlines.
29             Ex: {'cpu0': 'C0\nC1\n5000\n2000\n20\n30\n1406673171'}
30
31     Returns:
32         Dictionary associating a c-state with a time.
33     """
34     raise NotImplementedError()