Ahmed Karaman <ahmedkhaledkara...@gmail.com> writes:
> On Wed, Jun 17, 2020 at 2:21 PM Alex Bennée <alex.ben...@linaro.org> wrote: > >> > + >> > +# Run perf repcord and report >> > +os.system('sudo perf record {} {} 2> /dev/null \ >> > + && sudo perf report --stdio > tmp.perf.data' >> > + .format(qemu_path, executable)) >> >> Why sudo? > > This is the default requirement by perf. You can modify the > kernel.perf_event_paranoid setting to run without root privileges. Right - which I do as a developer. It would be rude to sudo things if you don't need to because then you end up running your potentially un-trusted application with root privileges. Could we either probe for the requirement or require an explicit sudo flag which we can prompt for if it fails? > >> Also redirecting just stderr? why? > > Perf, as well as Valgrind, print their output on stderr not stdout. Right so I think a bit of splitting apart and use of subprocess can make this cleaner and not involve quite so much being done with shell redirection in one invocation. > >> I think you could separate the steps (as well as use the subprocess >> api). > > Noted! > >> Again os.unlink() > > Noted! -- Alex Bennée