| Index: tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py
|
| diff --git a/tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py b/tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py
|
| index 8a7ddd0d81593fd16f8825b97c2a98c684106e4b..7516cef03fa616c34711c702d83be40644b48c82 100644
|
| --- a/tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py
|
| +++ b/tools/telemetry/telemetry/core/platform/proc_supporting_platform_backend.py
|
| @@ -2,6 +2,8 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +import collections
|
| +
|
| try:
|
| import resource # pylint: disable=F0401
|
| except ImportError:
|
| @@ -32,6 +34,22 @@ class ProcSupportingPlatformBackend(platform_backend.PlatformBackend):
|
| meminfo = self._GetProcFileDict(meminfo_contents)
|
| return self._ConvertKbToByte(meminfo['MemTotal'])
|
|
|
| + def GetGlobalCpuStats(self):
|
| + num_cpus = int(self._GetFileContents(
|
| + '/sys/devices/system/cpu/kernel_max'))
|
| + cpu_frequencies = collections.defaultdict(int)
|
| + for cpu in range(num_cpus):
|
| + try:
|
| + stats = self._GetFileContents(
|
| + '/sys/devices/system/cpu/cpu%d/cpufreq/stats/time_in_state' %
|
| + cpu)
|
| + for e in stats.splitlines():
|
| + k, v = e.split()
|
| + cpu_frequencies[k + '_hz'] += int(v)
|
| + except IOError:
|
| + continue
|
| + return {'GlobalCpuFrequencyStats': cpu_frequencies}
|
| +
|
| def GetCpuStats(self, pid):
|
| stats = self._GetProcFileForPid(pid, 'stat')
|
| if not stats:
|
|
|