From b5f36610ad66affacca17041d376c4c05a7d2d66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Pierre-Cl=C3=A9ment=20Tosi?= Date: Fri, 3 May 2019 11:37:45 +0100 Subject: [PATCH] trace/perf: Soften POSIX signal for termination Replace the default SIGKILL signal sent to perf to "request" its termination by a SIGINT, allowing it to handle the signal by cleaning up before exit. This should address issues regarding corrupted perf.data output files. --- devlib/trace/perf.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/devlib/trace/perf.py b/devlib/trace/perf.py index 5d5ac9b..17c2009 100644 --- a/devlib/trace/perf.py +++ b/devlib/trace/perf.py @@ -104,7 +104,11 @@ class PerfCollector(TraceCollector): self.target.kick_off(command) def stop(self): + self.target.killall('perf', signal='SIGINT', + as_root=self.target.is_rooted) + # perf doesn't transmit the signal to its sleep call so handled here: self.target.killall('sleep', as_root=self.target.is_rooted) + # NB: we hope that no other "important" sleep is on-going # pylint: disable=arguments-differ def get_trace(self, outdir):