Objective:
- Provide a common framework in LLVM for collecting various usage
metrics
- Characteristics:
- Extensible and configurable by:
- tools in LLVM that want to use it
- vendors in their downstream codebase
- tools users (as allowed by vendor)
Background:
The framework was originally proposed only for LLDB, but there were
quite a few requests to move it to llvm/lib given telemetry
is a common use case in a lot of tools, not just LLDB.
See more details on the design and discussions here on the RFC:
https://discourse.llvm.org/t/rfc-lldb-telemetry-metrics/64588/20?u=oontvoo
---------
Co-authored-by: Alina Sbirlea <alina.g.simion@gmail.com>
Co-authored-by: James Henderson <James.Henderson@sony.com>
Co-authored-by: Pavel Labath <pavel@labath.sk>
27 lines
629 B
C++
27 lines
629 B
C++
#include "llvm/Telemetry/Telemetry.h"
|
|
|
|
namespace llvm {
|
|
namespace telemetry {
|
|
|
|
void TelemetryInfo::serialize(Serializer &serializer) const {
|
|
serializer.write("SessionId", SessionId);
|
|
}
|
|
|
|
Error Manager::dispatch(TelemetryInfo *Entry) {
|
|
if (Error Err = preDispatch(Entry))
|
|
return std::move(Err);
|
|
|
|
Error AllErrs = Error::success();
|
|
for (auto &Dest : Destinations) {
|
|
AllErrs = joinErrors(std::move(AllErrs), Dest->receiveEntry(Entry));
|
|
}
|
|
return AllErrs;
|
|
}
|
|
|
|
void Manager::addDestination(std::unique_ptr<Destination> Dest) {
|
|
Destinations.push_back(std::move(Dest));
|
|
}
|
|
|
|
} // namespace telemetry
|
|
} // namespace llvm
|