diff options
author | Sam McCall <sam.mccall@gmail.com> | 2017-11-02 09:21:51 +0000 |
---|---|---|
committer | Sam McCall <sam.mccall@gmail.com> | 2017-11-02 09:21:51 +0000 |
commit | 0c84b41c2a274101149e5c0f6acdb9654708399c (patch) | |
tree | 8229a7dcb16cc3e3a2b66372f40515e032a1c104 /clang-tools-extra/unittests/clangd/CMakeLists.txt | |
parent | 6515070972df12203949f2eeab7210dc1c665de8 (diff) |
Performance tracing facility for clangd.
Summary:
This lets you visualize clangd's activity on different threads over time,
and understand critical paths of requests and object lifetimes.
The data produced can be visualized in Chrome (at chrome://tracing), or
in a standalone copy of catapult (http://github.com/catapult-project/catapult)
This patch consists of:
- a command line flag "-trace" that causes clangd to emit JSON trace data
- an API (in Trace.h) allowing clangd code to easily add events to the stream
- several initial uses of this API to capture JSON-RPC requests, builds, logs
Example result: https://photos.app.goo.gl/12L9swaz5REGQ1rm1
Caveats:
- JSON serialization is ad-hoc (isn't it everywhere?) so the API is
limited to naming events rather than attaching arbitrary metadata.
I'd like to fix this (I think we could use a JSON-object abstraction).
- The recording is very naive: events are written immediately by
locking a mutex. Contention on the mutex might disturb performance.
- For now it just traces instants or spans on the current thread.
There are other things that make sense to show (cross-thread flows,
non-thread resources such as ASTs). But we have to start somewhere.
Reviewers: ioeric, ilya-biryukov
Subscribers: cfe-commits, mgorny
Differential Revision: https://reviews.llvm.org/D39086
Diffstat (limited to 'clang-tools-extra/unittests/clangd/CMakeLists.txt')
-rw-r--r-- | clang-tools-extra/unittests/clangd/CMakeLists.txt | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/clang-tools-extra/unittests/clangd/CMakeLists.txt b/clang-tools-extra/unittests/clangd/CMakeLists.txt index 38ae2803fd2..f45bc712381 100644 --- a/clang-tools-extra/unittests/clangd/CMakeLists.txt +++ b/clang-tools-extra/unittests/clangd/CMakeLists.txt @@ -10,6 +10,7 @@ include_directories( add_extra_unittest(ClangdTests ClangdTests.cpp + TraceTests.cpp ) target_link_libraries(ClangdTests |