Added dynamic tables for preceding and following flows
Following/Preceding tables contain all entries of flow events table
that directly or indirectly connected to the starting slice.
FOLLOWING_FLOW(start_slice_id) - all entries of flow events table that
have flow.slice_out=start_slice_id or there is a chain of slice_ids:
start_slice_id -> slice_id_1 -> ... slice_id_n -> flow.slice_in
and each pair of neighbour slices in this chain has a flow between them
PRECEDING_FLOW(start_slice_id) - the same as FOLLOWING_FLOW but in
opposite direction.
CONNECTED_FLOW(start_slice_id) - union if following and preceding tables
Bug:153137035
Change-Id: I1c464ba35a360004b5d3c4dfd83cc31f27107ac4
diff --git a/docs/analysis/trace-processor.md b/docs/analysis/trace-processor.md
index 6d28c2f..d054103 100644
--- a/docs/analysis/trace-processor.md
+++ b/docs/analysis/trace-processor.md
@@ -347,6 +347,31 @@
FROM interesting_slices
```
+### Following/Preceding/Connected flows
+following_flow, preceding_flow, connected_flow are custom operator tables that
+take a [slice table's id column](/docs/analysis/sql-tables.autogen#slice) and
+collect all entries of [flow table](/docs/analysis/sql-tables.autogen#flow),
+that are directly or indirectly connected to the given starting slice.
+
+`FOLLOWING_FLOW(start_slice_id)` - contains all entries of
+[flow table](/docs/analysis/sql-tables.autogen#flow)
+that are present in any chain of kind: `flow[0] -> flow[1] -> ... -> flow[n]`,
+where `flow[i].slice_out = flow[i+1].slice_in` and
+`flow[0].slice_out = start_slice_id`.
+
+`PRECEDING_FLOW(start_slice_id)` - contains all entries of
+[flow table](/docs/analysis/sql-tables.autogen#flow)
+that are present in any chain of kind: `flow[n] -> flow[n-1] -> ... -> flow[0]`,
+where `flow[i].slice_in = flow[i+1].slice_out` and
+`flow[0].slice_in = start_slice_id`.
+
+`CONNECTED_FLOW(start_slice_id)` - contains a union of both
+`FOLLOWING_FLOW(start_slice_id)` and `PRECEDING_FLOW(start_slice_id)` tables.
+
+```sql
+--number of following flows for each slice
+SELECT (SELECT COUNT(*) FROM FOLLOWING_FLOW(slice_id)) as following FROM slice;
+```
## Metrics