Creating a flow where the sink starts before the source
I am currently using the Perfetto protos to generate trace files (follow up to https://github.com/google/perfetto/issues/432).
Most things are going well, but I am having trouble specifying flows. Specifically, when I want to create a flow from TraceEvent A to B, where:
start_time(A) < start_time(B)
end_time(A) >= end_time(B)
In this case, I want to add a flow from A to B. If I do something like this:
A->mutable_track_event()->add_flow_ids(id);
B->mutable_track_event()->add_terminating_flow_ids(id);
Then the flow doesn't show up.
If I do this:
A->mutable_track_event()->add_flow_ids(id);
B->mutable_track_event()->add_flow_ids(id);
then a flow is added from B to A (not what I want).
Based on the comments in here, I guess this is expected?
// The direction of the flows between events is inferred from the events' // timestamps. The earliest event with the same flow ID becomes the source // of the flow. Any events thereafter are intermediate steps of the flow, // until the flow terminates at the last event with the flow ID.
Question: how can I add the flow I want in this case? Maybe using a LegacyEvent?
Ah, the fix was to add the flow_id to the end TraceEvent as well, I was only adding it to the "start" event.
Glad you managed to get to the bottom of this!