clang-tools  12.0.0git
Classes | Functions
clang::clangd::trace Namespace Reference

Classes

class  EventTracer
 A consumer of trace events and measurements. More...
 
struct  Metric
 Represents measurements of clangd events, e.g. More...
 
class  Session
 Sets up a global EventTracer that consumes events produced by Span and trace::log. More...
 
class  Span
 Records an event whose duration is the lifetime of the Span object. More...
 
class  TestTracer
 A RAII Tracer that can be used by tests. More...
 

Functions

std::unique_ptr< EventTracercreateJSONTracer (llvm::raw_ostream &OS, bool Pretty=false)
 Create an instance of EventTracer that produces an output in the Trace Event format supported by Chrome's trace viewer (chrome://tracing). More...
 
std::unique_ptr< EventTracercreateCSVMetricTracer (llvm::raw_ostream &OS)
 Create an instance of EventTracer that outputs metric measurements as CSV. More...
 
void log (const llvm::Twine &Name)
 Records a single instant event, associated with the current thread. More...
 
static Context makeSpanContext (llvm::Twine Name, llvm::json::Object *Args, const Metric &LatencyMetric)
 
constexpr Metric SpanLatency ("span_latency", Metric::Distribution, "span_name")
 

Function Documentation

◆ createCSVMetricTracer()

std::unique_ptr< EventTracer > clang::clangd::trace::createCSVMetricTracer ( llvm::raw_ostream &  OS)

Create an instance of EventTracer that outputs metric measurements as CSV.

Trace spans and instant events are ignored.

Definition at line 270 of file Trace.cpp.

References OS.

Referenced by main().

◆ createJSONTracer()

std::unique_ptr< EventTracer > clang::clangd::trace::createJSONTracer ( llvm::raw_ostream &  OS,
bool  Pretty = false 
)

Create an instance of EventTracer that produces an output in the Trace Event format supported by Chrome's trace viewer (chrome://tracing).

FIXME: Metrics are not recorded, some could become counter events.

The format is documented here: https://docs.google.com/document/d/1CvAClvFfyA5R-PhYUmn5OOQtYMH4h6I0nSsKchNAySU/preview

Definition at line 265 of file Trace.cpp.

Referenced by main().

◆ log()

void clang::clangd::trace::log ( const llvm::Twine &  Message)

Records a single instant event, associated with the current thread.

Definition at line 274 of file Trace.cpp.

Referenced by clang::clangd::StreamLogger::log().

◆ makeSpanContext()

static Context clang::clangd::trace::makeSpanContext ( llvm::Twine  Name,
llvm::json::Object *  Args,
const Metric LatencyMetric 
)
static

Definition at line 281 of file Trace.cpp.

◆ SpanLatency()

constexpr Metric clang::clangd::trace::SpanLatency ( "span_latency"  ,
Metric::Distribution  ,
"span_name"   
)