ARM-software / devlib

Library for interaction with and instrumentation of remote devices.
Apache License 2.0
47 stars 78 forks source link

ftrace: Support trace-cmd record mode #643

Open mrkajetanp opened 1 year ago

mrkajetanp commented 1 year ago

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.

mrkajetanp commented 1 year ago

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.

mrkajetanp commented 1 year ago

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.

douglas-raillard-arm commented 5 months ago

Pending on: https://github.com/ARM-software/devlib/issues/645