clang-tools 20.0.0git
Public Member Functions | List of all members
clang::clangd::trace::TestTracer Class Reference

A RAII Tracer that can be used by tests. More...

#include <TestTracer.h>

Inheritance diagram for clang::clangd::trace::TestTracer:
Inheritance graph
[legend]

Public Member Functions

 TestTracer ()
 
void record (const Metric &Metric, double Value, llvm::StringRef Label) override
 Stores all the measurements to be returned with take later on.
 
std::vector< double > takeMetric (llvm::StringRef Metric, llvm::StringRef Label="")
 Returns recorded measurements for Metric and clears them.
 
- Public Member Functions inherited from clang::clangd::trace::EventTracer
virtual ~EventTracer ()=default
 
virtual Context beginSpan (llvm::StringRef Name, llvm::function_ref< void(llvm::json::Object *)> AttachDetails)
 Called when event that has a duration starts.
 
virtual void endSpan ()
 
virtual void instant (llvm::StringRef Name, llvm::json::Object &&Args)
 Called for instant events.
 
virtual void record (const Metric &Metric, double Value, llvm::StringRef Label)
 Called whenever a metrics records a measurement.
 

Detailed Description

A RAII Tracer that can be used by tests.

Definition at line 28 of file TestTracer.h.

Constructor & Destructor Documentation

◆ TestTracer()

clang::clangd::trace::TestTracer::TestTracer ( )
inline

Definition at line 30 of file TestTracer.h.

Member Function Documentation

◆ record()

void clang::clangd::trace::TestTracer::record ( const Metric Metric,
double  Value,
llvm::StringRef  Label 
)
overridevirtual

Stores all the measurements to be returned with take later on.

Reimplemented from clang::clangd::trace::EventTracer.

Definition at line 17 of file TestTracer.cpp.

References clang::clangd::Label, clang::clangd::trace::Metric::Name, and clang::clangd::Value.

◆ takeMetric()

std::vector< double > clang::clangd::trace::TestTracer::takeMetric ( llvm::StringRef  Metric,
llvm::StringRef  Label = "" 
)

Returns recorded measurements for Metric and clears them.

Definition at line 23 of file TestTracer.cpp.

References clang::clangd::Label.


The documentation for this class was generated from the following files: