| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
#ifndef LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_SUPPORT_TESTTRACER_H |
| 14 |
#define LLVM_CLANG_TOOLS_EXTRA_CLANGD_UNITTESTS_SUPPORT_TESTTRACER_H |
| 15 |
|
| 16 |
#include "support/Trace.h" |
| 17 |
#include "llvm/ADT/StringMap.h" |
| 18 |
#include "llvm/ADT/StringRef.h" |
| 19 |
#include <mutex> |
| 20 |
#include <string> |
| 21 |
#include <vector> |
| 22 |
|
| 23 |
namespace clang { |
| 24 |
namespace clangd { |
| 25 |
namespace trace { |
| 26 |
|
| 27 |
|
| 28 |
class TestTracer : public EventTracer { |
| 29 |
public: |
| 30 |
TestTracer() : S(*this) {} |
| 31 |
|
| 32 |
void record(const Metric &Metric, double Value, |
| 33 |
llvm::StringRef Label) override; |
| 34 |
|
| 35 |
|
| 36 |
std::vector<double> takeMetric(llvm::StringRef Metric, |
| 37 |
llvm::StringRef Label = ""); |
| 38 |
|
| 39 |
private: |
| 40 |
std::mutex Mu; |
| 41 |
|
| 42 |
llvm::StringMap<llvm::StringMap<std::vector<double>>> Measurements; |
| 43 |
Session S; |
| 44 |
}; |
| 45 |
|
| 46 |
} |
| 47 |
} |
| 48 |
} |
| 49 |
#endif |