clang-tools 20.0.0git
|
A tree that can be used to represent memory usage of nested components while preserving the hierarchy. More...
#include <MemoryTree.h>
Public Member Functions | |
MemoryTree (llvm::BumpPtrAllocator *DetailAlloc=nullptr) | |
If Alloc is nullptr, tree is in brief mode and will ignore detail edges. | |
MemoryTree & | child (llvm::StringLiteral Name) |
No copy of the Name . | |
MemoryTree (const MemoryTree &)=delete | |
MemoryTree & | operator= (const MemoryTree &)=delete |
MemoryTree (MemoryTree &&)=default | |
MemoryTree & | operator= (MemoryTree &&)=default |
MemoryTree & | detail (llvm::StringRef Name) |
Makes a copy of the Name in detailed mode, returns current node otherwise. | |
void | addUsage (size_t Increment) |
Increases size of current node by Increment . | |
const llvm::DenseMap< llvm::StringRef, MemoryTree > & | children () const |
Returns edges to direct children of this node. | |
size_t | total () const |
Returns total number of bytes used by this sub-tree. Performs a traversal. | |
size_t | self () const |
Returns total number of bytes used by this node only. | |
A tree that can be used to represent memory usage of nested components while preserving the hierarchy.
Edges have associated names. An edge that might not be interesting to all traversers or costly to copy (e.g. file names) can be marked as "detail". Tree construction allows chosing between a detailed and brief mode, in brief mode all "detail" edges are ignored and tree is constructed without any string copies.
Definition at line 30 of file MemoryTree.h.
|
inline |
If Alloc is nullptr, tree is in brief mode and will ignore detail edges.
Definition at line 33 of file MemoryTree.h.
|
delete |
|
default |
|
inline |
Increases size of current node by Increment
.
Definition at line 56 of file MemoryTree.h.
Referenced by clang::clangd::BackgroundIndex::profile(), clang::clangd::FileSymbols::profile(), clang::clangd::FileIndex::profile(), and clang::clangd::TUScheduler::profile().
|
inline |
No copy of the Name
.
Note that returned pointers are invalidated with subsequent calls to child/detail.
Definition at line 39 of file MemoryTree.h.
References Name.
Referenced by clang::clangd::ClangdLSPServer::profile(), clang::clangd::ClangdServer::profile(), clang::clangd::BackgroundIndex::profile(), clang::clangd::FileSymbols::profile(), clang::clangd::FileIndex::profile(), and clang::clangd::TUScheduler::profile().
const llvm::DenseMap< llvm::StringRef, MemoryTree > & clang::clangd::MemoryTree::children | ( | ) | const |
Returns edges to direct children of this node.
Definition at line 42 of file MemoryTree.cpp.
Referenced by clang::clangd::toJSON().
|
inline |
Makes a copy of the Name
in detailed mode, returns current node otherwise.
Note that returned pointers are invalidated with subsequent calls to child/detail.
Definition at line 51 of file MemoryTree.h.
References Name.
Referenced by clang::clangd::FileSymbols::profile(), and clang::clangd::TUScheduler::profile().
|
delete |
|
default |
|
inline |
Returns total number of bytes used by this node only.
Definition at line 65 of file MemoryTree.h.
Referenced by clang::clangd::toJSON().
size_t clang::clangd::MemoryTree::total | ( | ) | const |
Returns total number of bytes used by this sub-tree. Performs a traversal.
Definition at line 46 of file MemoryTree.cpp.
References Total.