This revision was automatically updated to reflect the committed changes.
Closed by commit rL340601: [clangd] Log memory usage of DexIndex and MemIndex
(authored by omtcyfz, committed by ).
Herald added a subscriber: llvm-commits.
Changed prior to commit:
https://reviews.llvm.org/D51154?vs=1623
kbobyrev added a comment.
In https://reviews.llvm.org/D51154#1211376, @ioeric wrote:
> Do we plan to expose an API in `ClangdServer` to allow C++ API users to track
> index memory usages?
I think we do, IIUC the conclusion of the offline discussion was that it might
be useful for the clients.
kbobyrev updated this revision to Diff 162334.
kbobyrev marked 3 inline comments as done.
kbobyrev added a comment.
Address few concerns.
https://reviews.llvm.org/D51154
Files:
clang-tools-extra/clangd/index/FileIndex.cpp
clang-tools-extra/clangd/index/FileIndex.h
clang-tools-extra/clangd
sammccall accepted this revision.
sammccall added inline comments.
This revision is now accepted and ready to land.
Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:123
+ size_t Bytes = Index.estimateMemoryUsage();
+ for (const auto &Scheme : URISchemes) {
+// std::
ioeric added a comment.
Do we plan to expose an API in `ClangdServer` to allow C++ API users to track
index memory usages?
Comment at: clang-tools-extra/clangd/index/FileIndex.cpp:123
+ size_t Bytes = Index.estimateMemoryUsage();
+ for (const auto &Scheme : URISchemes) {
+
kbobyrev updated this revision to Diff 162184.
kbobyrev marked 2 inline comments as done.
kbobyrev added a comment.
Slightly simplify the code.
https://reviews.llvm.org/D51154
Files:
clang-tools-extra/clangd/index/FileIndex.cpp
clang-tools-extra/clangd/index/FileIndex.h
clang-tools-extra/
ilya-biryukov added a comment.
Some drive-by NITS.
Comment at: clang-tools-extra/clangd/index/MemIndex.cpp:109
+std::lock_guard Lock(Mutex);
+
+Bytes += Index.getMemorySize();
Why not simply `return Index.getMemorySize()` under a lock?
===
kbobyrev added inline comments.
Comment at: clang-tools-extra/clangd/index/dex/DexIndex.cpp:180
+ Bytes += SymbolQuality.size() * sizeof(std::pair);
+ Bytes += InvertedIndex.size() * sizeof(Token);
+ {
sammccall wrote:
> I think you're not counting the size of
kbobyrev updated this revision to Diff 162146.
kbobyrev marked 6 inline comments as done.
kbobyrev added a comment.
Address a bunch of comments.
https://reviews.llvm.org/D51154
Files:
clang-tools-extra/clangd/index/FileIndex.cpp
clang-tools-extra/clangd/index/FileIndex.h
clang-tools-extra
sammccall added inline comments.
Comment at: clang-tools-extra/clangd/index/MemIndex.cpp:105
+size_t MemIndex::estimateMemoryUsage() {
+ size_t Bytes = Index.size() * sizeof(std::pair);
+ return Bytes / (1000 * 1000);
access to Index needs to be guarded by mute
kbobyrev created this revision.
kbobyrev added reviewers: ioeric, ilya-biryukov, sammccall.
kbobyrev added a project: clang-tools-extra.
Herald added subscribers: kadircet, arphaman, jkorous, MaskRay.
This patch prints information about built index size estimation to verbose
logs. This is useful
11 matches
Mail list logo