This is an archive of the discontinued LLVM Phabricator instance.

[clangd] When replying, log the method name and latency.
ClosedPublic

Authored by sammccall on Oct 24 2018, 7:45 AM.

Details

Summary

This information is strictly available in the log (you can find the original
call) but it makes the log easier to follow in practice.

Diff Detail

Repository
rL LLVM

Event Timeline

sammccall created this revision.Oct 24 2018, 7:45 AM

Log now looks something like this:

I[16:47:01.225] <-- textDocument/completion("2")
I[16:47:01.233] Ignored diagnostic. /usr/local/google/home/sammccall/temp/test.cc:7:1:'main' must return 'int'
I[16:47:01.234] Code complete: sema context Statement, query scopes [] (AnyScope=false)
I[16:47:01.234] Code complete: 0 results from Sema, 0 from Index, 0 matched, 0 returned.
I[16:47:01.234] --> reply:textDocument/completion("2") 8 ms

LG, thanks!

clangd/ClangdLSPServer.cpp
218 ↗(On Diff #170890)

Move locking below to not lock while copying reply.

221 ↗(On Diff #170890)

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)

kadircet accepted this revision.Oct 24 2018, 8:11 AM
This revision is now accepted and ready to land.Oct 24 2018, 8:11 AM
sammccall marked an inline comment as done.Oct 24 2018, 8:18 AM
sammccall added inline comments.
clangd/ClangdLSPServer.cpp
221 ↗(On Diff #170890)

As discussed offline, this is interesting, but only relevant for really huge responses and probably noise the rest of the time.
Let's leave it out for now, but may be worth adding locally when debugging this.

This revision was automatically updated to reflect the committed changes.