[clangd] Add a helper for exposing tracer status

This commit is contained in:
Kadir Cetinkaya 2020-10-09 10:35:40 +02:00
parent 23a53301c5
commit 20f69ccfe6
No known key found for this signature in database
GPG Key ID: E39E36B8D2057ED6
2 changed files with 5 additions and 0 deletions

View File

@ -281,6 +281,8 @@ void log(const llvm::Twine &Message) {
T->instant("Log", llvm::json::Object{{"Message", Message.str()}});
}
bool enabled() { return T != nullptr; }
// The JSON object is event args (owned by context), if the tracer wants them.
static std::pair<Context, llvm::json::Object *>
makeSpanContext(llvm::Twine Name, const Metric &LatencyMetric) {

View File

@ -128,6 +128,9 @@ std::unique_ptr<EventTracer> createCSVMetricTracer(llvm::raw_ostream &OS);
/// Records a single instant event, associated with the current thread.
void log(const llvm::Twine &Name);
/// Returns true if there is an active tracer.
bool enabled();
/// Records an event whose duration is the lifetime of the Span object.
/// This lifetime is extended when the span's context is reused.
///