devlib
devlib copied to clipboard
ftrace: Support trace-cmd record mode
The current implementation of the FtraceCollector only supports using ftrace in its start-stop mode which keeps the traces in memory and then writes to file at the end. Trace-cmd also supports a different mode - record which writes to file periodically meaning that it allows recording traces that would exceed the 'start' mode buffer size in exchange for added noise.
This commit adds support for selecting which mode trace-cmd should be run in. It adds a new collector parameter - 'trace_cmd_mode' which is used to distinguish between the two approaches.
While at it, it also cleans up the collector in some places, e.g. the teardown() method.
I pushed an update to make the entire collector just use a tempdir inside the working directory from the start for both modes. If nothing else it'll make it more self contained.
Updated to wait until the background command actually exits after sending SIGINT - otherwise there's a race condition with removing the temp directory in the teardown() method.
Pending on: https://github.com/ARM-software/devlib/issues/645