mirror of
https://github.com/ARM-software/devlib.git
synced 2025-01-31 02:00:45 +00:00
collector/perf: Only kill sleep if running perf stat
The stop() command of the PerfCollector kills all sleep commands in the target, saying "We hope that no other important sleep is on-going". This is only needed if we are running "perf stat", simpleperf does not need this. Background the perf/simpleperf command and only kill all sleeps in that specific case.
This commit is contained in:
parent
5d342044a2
commit
4859e818fb
@ -24,7 +24,7 @@ from devlib.collector import (CollectorBase, CollectorOutput,
|
|||||||
from devlib.utils.misc import ensure_file_directory_exists as _f
|
from devlib.utils.misc import ensure_file_directory_exists as _f
|
||||||
|
|
||||||
|
|
||||||
PERF_COMMAND_TEMPLATE = '{binary} {command} {options} {events} sleep 1000 > {outfile} 2>&1 '
|
PERF_STAT_COMMAND_TEMPLATE = '{binary} {command} {options} {events} {sleep_cmd} > {outfile} 2>&1 '
|
||||||
PERF_REPORT_COMMAND_TEMPLATE= '{binary} report {options} -i {datafile} > {outfile} 2>&1 '
|
PERF_REPORT_COMMAND_TEMPLATE= '{binary} report {options} -i {datafile} > {outfile} 2>&1 '
|
||||||
PERF_RECORD_COMMAND_TEMPLATE= '{binary} record {options} {events} -o {outfile}'
|
PERF_RECORD_COMMAND_TEMPLATE= '{binary} record {options} {events} -o {outfile}'
|
||||||
|
|
||||||
@ -141,14 +141,15 @@ class PerfCollector(CollectorBase):
|
|||||||
|
|
||||||
def start(self):
|
def start(self):
|
||||||
for command in self.commands:
|
for command in self.commands:
|
||||||
self.target.kick_off(command, as_root=self.target.is_rooted)
|
self.target.background(command, as_root=self.target.is_rooted)
|
||||||
|
|
||||||
def stop(self):
|
def stop(self):
|
||||||
self.target.killall(self.perf_type, signal='SIGINT',
|
self.target.killall(self.perf_type, signal='SIGINT',
|
||||||
as_root=self.target.is_rooted)
|
as_root=self.target.is_rooted)
|
||||||
# perf doesn't transmit the signal to its sleep call so handled here:
|
if self.perf_type == "perf" and self.command == "stat":
|
||||||
self.target.killall('sleep', as_root=self.target.is_rooted)
|
# perf doesn't transmit the signal to its sleep call so handled here:
|
||||||
# NB: we hope that no other "important" sleep is on-going
|
self.target.killall('sleep', as_root=self.target.is_rooted)
|
||||||
|
# NB: we hope that no other "important" sleep is on-going
|
||||||
|
|
||||||
def set_output(self, output_path):
|
def set_output(self, output_path):
|
||||||
self.output_path = output_path
|
self.output_path = output_path
|
||||||
@ -188,10 +189,12 @@ class PerfCollector(CollectorBase):
|
|||||||
|
|
||||||
def _build_perf_stat_command(self, options, events, label):
|
def _build_perf_stat_command(self, options, events, label):
|
||||||
event_string = ' '.join(['-e {}'.format(e) for e in events])
|
event_string = ' '.join(['-e {}'.format(e) for e in events])
|
||||||
command = PERF_COMMAND_TEMPLATE.format(binary = self.binary,
|
sleep_cmd = 'sleep 1000' if self.perf_type == 'perf' else ''
|
||||||
|
command = PERF_STAT_COMMAND_TEMPLATE.format(binary = self.binary,
|
||||||
command = self.command,
|
command = self.command,
|
||||||
options = options or '',
|
options = options or '',
|
||||||
events = event_string,
|
events = event_string,
|
||||||
|
sleep_cmd = sleep_cmd,
|
||||||
outfile = self._get_target_file(label, 'out'))
|
outfile = self._get_target_file(label, 'out'))
|
||||||
return command
|
return command
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user