Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[tracecompass-dev] Trace trimming and stream intersection features

Hi all,

With the upcoming release of Babeltrace 2 (!), I have recently finished
cleaning up a set of patches to add the following features to Trace Compass:

- Trace trimming
- Stream intersection mode for CTF traces

Both make use of a Babeltrace 2 binary that would be present on the system.


Feature description
-------------------
Trace trimming means "cutting" the trace to a subset of its time range.
In addition, it saves a snapshot of all built state systems, so that the
new trace does not lose any state information.

Stream intersection is similar to trimming, except the target time range
is the intersection of all CTF streams in the trace. For example, if a
trace has stream1 that goes from timestamps 10 to 20 and stream2 that
goes from 15 to 25, the resulting "stream-intersected" trace will go
from 15 to 20.
The stream intersection operation is a common use case for snapshot
traces, where all streams may not have the same rate of events, but
analyses should focus on the section where all streams are defined.

Both features make use of Babeltrace 2 to do the actual trace cutting.
If Babeltrace 2 is not found on the PATH, the options are not available.


UI Presentation
---------------
Both features work by adding menu options to the context menu of traces.
Trace trimming is called "Export Time Selection as New Trace..." and
picks the currently selected time range as the target range.
Stream intersection is done using the "Perform Stream Intersection..."
action, which is defined only for CTF traces and their subtypes.
See the attached screenshot.

In both cases, a directory chooser asks the user for a writable
directory where to write the new trace, and a new trace is created and
imported into the current project. Analyses etc. have to be rebuilt for
the new traces anyway, so it did not really make sense to have a
"toggle" that would modify existing traces.


Caveats
-------
There are a few caveats to the current implementation:

- Trace cutting currently only works on single traces, not experiments.
The stream intersection feature in Babeltrace only works on single
traces anyway.
- There are tests included, but they are @Ignore'd by default, since the
features requires Babeltrace to be installed to work. Most CIs will not
have it installed, so I don't think the tests can be enabled by default.
- A few test traces are ignored because Babeltrace 2 currently fails to
read them. This is a bug on the reader side, unrelated to the trace
trimming. Once that is fixed in BT they could be restored.
- Babeltrace doesn't support Windows yet. A Windows port is planned as
part of the Babeltrace 2.0 release, at which point the features
mentioned here should work on Windows too.
- Stream intersection only works on indexed traces (traces with and
index/ subdirectory). This is also planned to be fixed before the
release of Babeltrace 2.0


The code is currently in the following git branch:
https://github.com/alexmonthy/tracecompass/commits/for-review-bt2

If there is interest in having this upstream, I can push it to Gerrit,
just let me know.


Cheers,
Alex

Attachment: trace-cut-menu.png
Description: PNG image


Back to the top