This is part of the larger XRay Profiling Mode effort.
This patch implements a centralised collector for FunctionCallTrie
instances, associated per thread. It maintains a global set of trie
instances which can be retrieved through the XRay API for processing
in-memory buffers (when registered). Future changes will include the
wiring to implement the actual profiling mode implementation.
This central service provides the following functionality:
- Posting a FunctionCallTrie associated with a thread, to the central list of tries.
- Serializing all the posted FunctionCallTrie instances into in-memory buffers.
- Resetting the global state of the serialized buffers and tries.
Depends on D45757.
Would be better (and more difficult) to validate the contents of the block in addition to the header. This doesn't verify that any of the profiling data is correct and consistent with the Trie.