This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
kadircet marked an inline comment as done.
Closed by commit rGe2f598bc1b37: [clangd] Record IO precentage for first 
preamble build of the instance (authored by kadircet).

Repository:
  rG LLVM Github Monorepo

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

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, [&] {
-    PreambleBuildFilesystemLatency.record(Stats.FileSystemTime, "first_build");
-  });
+  auto RecordWithLabel = [&Stats](llvm::StringRef Label) {
+    PreambleBuildFilesystemLatency.record(Stats.FileSystemTime, Label);
+    if (Stats.TotalBuildTime > 0) // Avoid division by zero.
+      PreambleBuildFilesystemLatencyRatio.record(
+          Stats.FileSystemTime / Stats.TotalBuildTime, Label);
+  };
 
-  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;


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, [&] {
-    PreambleBuildFilesystemLatency.record(Stats.FileSystemTime, "first_build");
-  });
+  auto RecordWithLabel = [&Stats](llvm::StringRef Label) {
+    PreambleBuildFilesystemLatency.record(Stats.FileSystemTime, Label);
+    if (Stats.TotalBuildTime > 0) // Avoid division by zero.
+      PreambleBuildFilesystemLatencyRatio.record(
+          Stats.FileSystemTime / Stats.TotalBuildTime, Label);
+  };
 
-  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;
_______________________________________________
cfe-commits mailing list
cfe-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/cfe-commits

Reply via email to