[llvm] [llvm]Add a simple Telemetry framework (PR #102323)
Vy Nguyen via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 11 07:20:29 PST 2024
================
@@ -8,71 +8,68 @@
///
/// \file
/// This file provides the basic framework for Telemetry
-///
-/// It comprises of three important structs/classes:
-///
-/// - Telemeter: The class responsible for collecting and forwarding
-/// telemery data.
-/// - TelemetryInfo: data courier
-/// - TelemetryConfig: this stores configurations on Telemeter.
-///
/// Refer to its documentation at llvm/docs/Telemetry.rst for more details.
//===---------------------------------------------------------------------===//
#ifndef LLVM_TELEMETRY_TELEMETRY_H
#define LLVM_TELEMETRY_TELEMETRY_H
-#include <chrono>
-#include <ctime>
-#include <memory>
-#include <optional>
-#include <string>
-
#include "llvm/ADT/StringExtras.h"
#include "llvm/ADT/StringRef.h"
#include "llvm/Support/Error.h"
#include "llvm/Support/JSON.h"
+#include <memory>
+#include <optional>
+#include <string>
namespace llvm {
namespace telemetry {
+class Serializer {
+public:
+ virtual llvm::Error start() = 0;
+ virtual void writeBool(StringRef KeyName, bool Value) = 0;
+ virtual void writeInt32(StringRef KeyName, int Value) = 0;
+ virtual void writeSizeT(StringRef KeyName, size_t Value) = 0;
+ virtual void writeString(StringRef KeyName, StringRef Value) = 0;
+ virtual void
+ writeKeyValueMap(StringRef KeyName,
+ const std::map<std::string, std::string> &Value) = 0;
+ virtual llvm::Error finish() = 0;
----------------
oontvoo wrote:
Good point. i think init() and finalize() is better.
https://github.com/llvm/llvm-project/pull/102323
More information about the llvm-commits
mailing list