Module tikv_alloc::trace[][src]

This module provides some utilities to define the tree hierarchy to trace memory.

A memory trace is a tree that records how much memory its children and itself uses, It doesn’t need to match any function stacktrace, instead it should have logically meaningful layout.

For example, memory usage should be divided into several components under the root scope: TiDB EndPoint, Transaction, Raft, gRPC etc. TiDB EndPoint can divide its children by queries, while Raft can divide memory by store and apply. Name are defined as number for better performance. In practice, it can be mapped to enumerates instead.

To define a memory trace tree, we can use the mem_trace macro. The mem_trace macro constructs every node as a MemoryTraceNode which implements MemoryTrace trait. We can also define a specified tree node by implementing MemoryTrace trait.

Structs

MemoryTraceNode
MemoryTraceSnapshot

Enums

Id
TraceEvent

Traits

MemoryTrace

Type Definitions

HashMap