[PATCH] D53647: [clangd] When replying, log the method name and latency.

Kadir Cetinkaya via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Wed Oct 24 08:11:22 PDT 2018


kadircet added a comment.

LG, thanks!



================
Comment at: clangd/ClangdLSPServer.cpp:218
+        log("--> reply:{0}({1}) {2:ms}", Method, ID, Duration);
+        std::lock_guard<std::mutex> Lock(Server->TranspWriter);
+        if (TraceArgs)
----------------
Move locking below to not lock while copying reply.


================
Comment at: clangd/ClangdLSPServer.cpp:221
           (*TraceArgs)["Reply"] = *Reply;
-        else {
-          auto Err = Reply.takeError();
+        Server->Transp.reply(std::move(ID), std::move(Reply));
+      } else {
----------------
What about also printing vlog after sending out reply? Because for "heavy" replies there is a huge difference between process time and serialization of response to json, sometimes it might help to see how much time is spent for serialization as well.(for example ycmd patch, it takes a few hundred ms to prepare reply, but then a few seconds to dump it)


Repository:
  rCTE Clang Tools Extra

https://reviews.llvm.org/D53647





More information about the cfe-commits mailing list