LLVM 22.0.0git
Telemetry.cpp
Go to the documentation of this file.
1//===----------------------------------------------------------------------===//
2//
3// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
4// See https://llvm.org/LICENSE.txt for license information.
5// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6//
7//===----------------------------------------------------------------------===//
8///
9/// \file
10/// This file provides the basic framework for Telemetry.
11/// Refer to its documentation at llvm/docs/Telemetry.rst for more details.
12//===---------------------------------------------------------------------===//
13
15
16namespace llvm {
17namespace telemetry {
18
19void TelemetryInfo::serialize(Serializer &serializer) const {
20 serializer.write("SessionId", SessionId);
21}
22
25 "Telemetry should have been enabled");
26 if (Error Err = preDispatch(Entry))
27 return Err;
28
29 Error AllErrs = Error::success();
30 for (auto &Dest : Destinations) {
31 AllErrs = joinErrors(std::move(AllErrs), Dest->receiveEntry(Entry));
32 }
33 return AllErrs;
34}
35
36void Manager::addDestination(std::unique_ptr<Destination> Dest) {
37 Destinations.push_back(std::move(Dest));
38}
39
41
42} // namespace telemetry
43} // namespace llvm
assert(UImm &&(UImm !=~static_cast< T >(0)) &&"Invalid immediate!")
This file provides the basic framework for Telemetry.
Lightweight error class with error context and mandatory checking.
Definition: Error.h:159
static ErrorSuccess success()
Create a success value.
Definition: Error.h:336
virtual Error preDispatch(TelemetryInfo *Entry)
Definition: Telemetry.cpp:40
void addDestination(std::unique_ptr< Destination > Destination)
Definition: Telemetry.cpp:36
virtual Error dispatch(TelemetryInfo *Entry)
Definition: Telemetry.cpp:23
virtual void write(StringRef KeyName, bool Value)=0
This is an optimization pass for GlobalISel generic memory operations.
Definition: AddressRanges.h:18
Error joinErrors(Error E1, Error E2)
Concatenate errors.
Definition: Error.h:442
static constexpr bool BuildTimeEnableTelemetry
Definition: Telemetry.h:68
TelemetryInfo is the data courier, used to move instrumented data from the tool being monitored to th...
Definition: Telemetry.h:105
virtual void serialize(Serializer &serializer) const
Definition: Telemetry.cpp:19