[PATCH] D122894: [clangd] Record IO precentage for first preamble build of the instance
Kadir Cetinkaya via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Fri Apr 1 04:53:36 PDT 2022
kadircet created this revision.
kadircet added a reviewer: adamcz.
Herald added subscribers: usaxena95, arphaman, javed.absar.
Herald added a project: All.
kadircet requested review of this revision.
Herald added subscribers: cfe-commits, MaskRay, ilya-biryukov.
Herald added a project: clang-tools-extra.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D122894
Files:
clang-tools-extra/clangd/TUScheduler.cpp
Index: clang-tools-extra/clangd/TUScheduler.cpp
===================================================================
--- clang-tools-extra/clangd/TUScheduler.cpp
+++ clang-tools-extra/clangd/TUScheduler.cpp
@@ -112,17 +112,16 @@
void reportPreambleBuild(const PreambleBuildStats &Stats,
bool IsFirstPreamble) {
- static llvm::once_flag OnceFlag;
- llvm::call_once(OnceFlag, [&] {
+ auto RecordWithLabel = [&Stats](llvm::StringRef Label) {
PreambleBuildFilesystemLatency.record(Stats.FileSystemTime, "first_build");
- });
+ if (Stats.TotalBuildTime > 0) // Avoid division by zero.
+ PreambleBuildFilesystemLatencyRatio.record(
+ Stats.FileSystemTime / Stats.TotalBuildTime, "first_build");
+ };
- const std::string Label =
- IsFirstPreamble ? "first_build_for_file" : "rebuild";
- PreambleBuildFilesystemLatency.record(Stats.FileSystemTime, Label);
- if (Stats.TotalBuildTime > 0) // Avoid division by zero.
- PreambleBuildFilesystemLatencyRatio.record(
- Stats.FileSystemTime / Stats.TotalBuildTime, Label);
+ static llvm::once_flag OnceFlag;
+ llvm::call_once(OnceFlag, [&] { RecordWithLabel("first_build"); });
+ RecordWithLabel(IsFirstPreamble ? "first_build_for_file" : "rebuild");
}
class ASTWorker;
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D122894.419718.patch
Type: text/x-patch
Size: 1287 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20220401/330ed8f2/attachment.bin>
More information about the cfe-commits
mailing list