The PerfCollector class uses the following pattern:
def reset(self):
self.target.killall(self.perf_type, as_root=self.target.is_rooted)
This is not great as self.perf_type can be set to perf, so the class ends up indiscriminately killing all perf processes on the system, possibly as root. This is not a very good neighborly behavior. Instead, it should spawn a process (e.g. with Target.background()) and kill that process specifically, without interfering with resources it does not own.