17 #ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_ 18 #define LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_ 21 #include "llvm/ADT/Twine.h" 22 #include "llvm/Support/JSON.h" 23 #include "llvm/Support/raw_ostream.h" 49 virtual void instant(llvm::StringRef Name, llvm::json::Object &&Args) = 0;
70 void log(
const llvm::Twine &
Name);
83 Span(llvm::Twine Name);
89 llvm::json::Object *
const Args;
97 #define SPAN_ATTACH(S, Name, Expr) \ 99 if (auto *Args = (S).Args) \ 100 (*Args)[Name] = Expr; \ 107 #endif // LLVM_CLANG_TOOLS_EXTRA_CLANGD_TRACE_H_ Sets up a global EventTracer that consumes events produced by Span and trace::log.
virtual ~EventTracer()=default
virtual void instant(llvm::StringRef Name, llvm::json::Object &&Args)=0
Called for instant events.
static constexpr llvm::StringLiteral Name
A context is an immutable container for per-request data that must be propagated through layers that ...
WithContext replaces Context::current() with a provided scope.
===– Representation.cpp - ClangDoc Representation --------—*- C++ -*-===//
void log(const llvm::Twine &Message)
Records a single instant event, associated with the current thread.
std::unique_ptr< EventTracer > createJSONTracer(llvm::raw_ostream &OS, bool Pretty)
Create an instance of EventTracer that produces an output in the Trace Event format supported by Chro...
llvm::json::Object *const Args
Mutable metadata, if this span is interested.
Records an event whose duration is the lifetime of the Span object.
virtual Context beginSpan(llvm::StringRef Name, llvm::json::Object *Args)=0
Called when event that has a duration starts.
A consumer of trace events.