[PATCH] D86077: [clangd] Add a way for exporting memory usage metrics

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Mon Aug 17 09:17:40 PDT 2020


kadircet marked 8 inline comments as done.
kadircet added inline comments.


================
Comment at: clang-tools-extra/clangd/TUScheduler.cpp:1309
+    // fileStats results include ast cache sizes too, subtract them.
+    PreambleBytes -= ASTCacheBytes;
+  }
----------------
adamcz wrote:
> So technically this is incorrect.
> IdleASTs might contain AST for a file that is no longer tracked (e.g. had removeDocument() called on it). ASTCacheBytes will include it, but PreambleBytes will not, since it only asks for size of the tracked files. It's probably fine, considering how rare this will be and that these are all estimates, but I would recommend a comment, in case someone sees PreambleBytes be negative and wonders what's going on.
right, thanks for pointing that out. added a comment, and clamped for non-negativity.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D86077/new/

https://reviews.llvm.org/D86077



More information about the cfe-commits mailing list