Closed pbaumbacher closed 2 years ago
Otherwise LGTM. I think if you rebased/squashed we could be good to merge.
I had to update the range logic a bit to handle Sample
events. The most straightforward way to do this was just to treat any stack containing a range symbol as a Symbol_hit
, but a consequence is that in sampling mode the filtered region begins at the end of the range start function, instead of at the beginning in tracing mode.
Making the behavior identical would require a bit more work: the control flow would have to be fairly different depending on if we're receiving sampling events or perf events. I think using sampling with the filter isn't likely to be a super common use-case, but let me know what you think.
Adds a new flag
-filter "(<start> <stop>)"
to magic trace. With this flag, the trace is trimmed to only include events that occur betweenstart
(inclusive) andstop
(exclusive) (#81). If either symbol doesn't appear in the trace, no output is produced. In multi-snapshot mode, the trace only includes regions between consecutivestart
andstop
calls. The-filter
flag is compatible with the same modes as the-trigger
flag.When producing a
.sexp
output, only events that occur in the filtered region are emitted. When producing a fuchsia.fxt
output, the full available callstack around the filtered region is reconstructed. Active stack frames at the beginning of the filtered region have the timestart
was called as their inferred start time.