1
0
mirror of https://github.com/ARM-software/devlib.git synced 2025-01-31 02:00:45 +00:00

Merge pull request #4 from derkling/cpufreq-tracing

Add support to properly trace CPUs frequencies
This commit is contained in:
setrofim 2015-11-16 18:06:10 +00:00
commit d4c8b0f222
2 changed files with 19 additions and 0 deletions

View File

@ -363,3 +363,16 @@ class CpufreqModule(Module):
"done"\
.format(governor), as_root=True)
def trace_frequencies(self):
"""
Report current frequencies on trace file
"""
self.target.execute(
'FREQS=$(cat /sys/devices/system/cpu/cpu*/cpufreq/scaling_cur_freq); '
'CPU=0; for F in $FREQS; do '
' echo "cpu_frequency: state=$F cpu_id=$CPU" > /sys/kernel/debug/tracing/trace_marker; '
' let CPU++; '
'done',
as_root=True
)

View File

@ -101,8 +101,14 @@ class FtraceCollector(TraceCollector):
if self.automark:
self.mark_start()
self.target.execute('{} start {}'.format(self.target_binary, self.event_string), as_root=True)
if 'cpufreq' in self.target.modules:
self.logger.debug('Trace CPUFreq frequencies')
self.target.cpufreq.trace_frequencies()
def stop(self):
if 'cpufreq' in self.target.modules:
self.logger.debug('Trace CPUFreq frequencies')
self.target.cpufreq.trace_frequencies()
self.stop_time = time.time()
if self.automark:
self.mark_stop()