[PATCH] D92181: [clangd] NFC: Add client-side logging for remote index requests
Kirill Bobyrev via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Nov 26 07:49:31 PST 2020
kbobyrev updated this revision to Diff 307869.
kbobyrev added a comment.
Switch Deadline type to `const auto`.
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D92181/new/
https://reviews.llvm.org/D92181
Files:
clang-tools-extra/clangd/index/remote/Client.cpp
Index: clang-tools-extra/clangd/index/remote/Client.cpp
===================================================================
--- clang-tools-extra/clangd/index/remote/Client.cpp
+++ clang-tools-extra/clangd/index/remote/Client.cpp
@@ -42,10 +42,13 @@
SPAN_ATTACH(Tracer, "Request", RPCRequest.DebugString());
grpc::ClientContext Context;
Context.AddMetadata("version", clang::getClangToolFullVersion("clangd"));
- std::chrono::system_clock::time_point Deadline =
- std::chrono::system_clock::now() + DeadlineWaitingTime;
+ const std::chrono::system_clock::time_point StartTime =
+ std::chrono::system_clock::now();
+ const auto Deadline = StartTime + DeadlineWaitingTime;
Context.set_deadline(Deadline);
auto Reader = (Stub.get()->*RPCCall)(&Context, RPCRequest);
+ vlog("Sending RPC Request {0}: {1}", RequestT::descriptor()->name(),
+ RPCRequest.DebugString());
ReplyT Reply;
unsigned Successful = 0;
unsigned FailedToParse = 0;
@@ -65,6 +68,11 @@
Callback(*Response);
++Successful;
}
+ const auto Millis = std::chrono::duration_cast<std::chrono::milliseconds>(
+ std::chrono::system_clock::now() - StartTime)
+ .count();
+ vlog("RPC Request {0} => OK: {1} results in {2}ms",
+ RequestT::descriptor()->name(), Successful, Millis);
SPAN_ATTACH(Tracer, "Status", Reader->Finish().ok());
SPAN_ATTACH(Tracer, "Successful", Successful);
SPAN_ATTACH(Tracer, "Failed to parse", FailedToParse);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D92181.307869.patch
Type: text/x-patch
Size: 1564 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/cfe-commits/attachments/20201126/348408b0/attachment.bin>
More information about the cfe-commits
mailing list