[clangd] Fix tracing now that spans lifetimes can overlap on a thread.
authorSam McCall <sam.mccall@gmail.com>
Thu, 15 Feb 2018 08:40:54 +0000 (08:40 +0000)
committerSam McCall <sam.mccall@gmail.com>
Thu, 15 Feb 2018 08:40:54 +0000 (08:40 +0000)
commit7929d006d732185eee759aa84bb10d4150373b9f
treea0d71dc49f75546a689445b03a5f4c85de3019e2
parent6f9e25d3824fb7b03dc6a403e1962d80a9c88ebe
[clangd] Fix tracing now that spans lifetimes can overlap on a thread.

Summary:
The chrome trace viewer requires events within a thread to strictly nest.
So we need to record the lifetime of the Span objects, not the contexts.

But we still want to show the relationship between spans where a context crosses
threads, so do this with flow events (i.e. arrows).

Before: https://photos.app.goo.gl/q4Dd9u9xtelaXk1v1
After: https://photos.app.goo.gl/5RNLmAMLZR3unvY83

(This could stand some further improvement, in particular I think we want a
container span whenever we schedule work on a thread. But that's another patch)

Reviewers: ioeric

Subscribers: klimek, ilya-biryukov, jkorous-apple, cfe-commits

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

llvm-svn: 325220
clang-tools-extra/clangd/Trace.cpp
clang-tools-extra/clangd/Trace.h
clang-tools-extra/test/clangd/trace.test
clang-tools-extra/unittests/clangd/TraceTests.cpp