[clang-tools-extra] 1677c86 - [clangd] Add metrics for go-to-implementation.

Haojian Wu via cfe-commits cfe-commits at lists.llvm.org
Mon Jan 11 01:34:01 PST 2021


Author: Haojian Wu
Date: 2021-01-11T10:26:50+01:00
New Revision: 1677c86124e5b82a8dbf991f2d5fc450d06db4ad

URL: https://github.com/llvm/llvm-project/commit/1677c86124e5b82a8dbf991f2d5fc450d06db4ad
DIFF: https://github.com/llvm/llvm-project/commit/1677c86124e5b82a8dbf991f2d5fc450d06db4ad.diff

LOG: [clangd] Add metrics for go-to-implementation.

Differential Revision: https://reviews.llvm.org/D94393

Added: 
    

Modified: 
    clang-tools-extra/clangd/XRefs.cpp

Removed: 
    


################################################################################
diff  --git a/clang-tools-extra/clangd/XRefs.cpp b/clang-tools-extra/clangd/XRefs.cpp
index 667a90aa2efb..8bb74ed7ae43 100644
--- a/clang-tools-extra/clangd/XRefs.cpp
+++ b/clang-tools-extra/clangd/XRefs.cpp
@@ -298,6 +298,17 @@ std::vector<LocatedSymbol> findImplementors(llvm::DenseSet<SymbolID> IDs,
                                             llvm::StringRef MainFilePath) {
   if (IDs.empty())
     return {};
+  static constexpr trace::Metric FindImplementorsMetric(
+      "find_implementors", trace::Metric::Counter, "case");
+  switch (Predicate) {
+  case RelationKind::BaseOf:
+    FindImplementorsMetric.record(1, "find-base");
+    break;
+  case RelationKind::OverriddenBy:
+    FindImplementorsMetric.record(1, "find-override");
+    break;
+  }
+
   RelationsRequest Req;
   Req.Predicate = Predicate;
   Req.Subjects = std::move(IDs);


        


More information about the cfe-commits mailing list