[tracing] Add infrastructure to account memory overhead of tracing.
Tracing uses memory for the trace log and for the refptr objects
that can be attached to the trace events (Convertable and friends).
This means that when enabling memory-infra tracing will measure also
its own memory that would not have been there if tracing was disabled
in the first place.
In order to mitigate this problem, this CL:
- Introduces EstimateTraceMemoryOverhead() method to the trace classes
to get a rough estimation of themselves.
- Adds a dumper for the general trace log + a dumper for each
thread-local event buffer.
- When invoked these dumpers dump the memory used by tracing itself to the
trace.
- The tracing dumpers produce a breakdown by object number and size.
This makes it much easier to recalibrate the self-accounting by
comparing the tracing numbers with external tools (e.g.,
Instruments on Mac).
This change should not affect the behvavior / performance of tracing when
memory-infra is not enabled. The OnMemoryDump methods, then, will not be
called.
BUG=495628
Review URL: https://codereview.chromium.org/
1148983011
Cr-Commit-Position: refs/heads/master@{#333862}