DescriptionRename ScopedThreadHeapUsage to ThreadHeapUsageTracker and change interface.
This is broken out from https://codereview.chromium.org/2386123003/, and the interface changes are influenced by actual usage.
The interface is changed to use explicit Start/Stop, instead of implicitly starting and stopping on creation/destruction. This is necessary to support exclusive scopes, which is how base/tracked_objects.h does task execution time measurement. Unfortunately a Scoped* abstraction can't support exclusive scopes, as here must always be a gap from reading the current state to when the Scoped* instance goes out of scope. Any heap activity in this gap will be lost from measurement, and will neither tally to the current nor the outer scope.
Initialization is also changed, such that TLS is initialized as heap tracking is enabled. It is now allowed to create ThreadHeapTracker instances without any initialization, though it's not allowed to Start() them.
BUG=644385
Committed: https://crrev.com/07856a7b8add0eba66d71fc62b5e32be9bc03d69
Cr-Commit-Position: refs/heads/master@{#425997}
Patch Set 1 #Patch Set 2 : Now even compiles. #Patch Set 3 : Make the no-Stop case go to inclusive Stop() at destruction. #Patch Set 4 : Rename ThreadAllocatorUsage->ThreadHeapUsage for less hubris. #Patch Set 5 : Improve docs, misc cleanup. #Patch Set 6 : Fix non-MSVC compilation error. #
Total comments: 4
Patch Set 7 : Address Chris' nits. #
Total comments: 10
Patch Set 8 : Address Lei Zhang's comments, fix leak in test. #
Total comments: 8
Patch Set 9 : Addressed Primiano's nits. #
Messages
Total messages: 37 (24 generated)
|