[Lldb-commits] [lldb] [RFC][LLDB] Telemetry in LLDB (PR #87815)

James Henderson via lldb-commits lldb-commits at lists.llvm.org
Mon Apr 8 00:37:45 PDT 2024


================
@@ -0,0 +1,237 @@
+#ifndef LLDB_CORE_TELEMETRY_H
+#define LLDB_CORE_TELEMETRY_H
+
+#include <chrono>
+#include <ctime>
+#include <memory>
+#include <optional>
+#include <string>
+
+#include "lldb/Interpreter/CommandReturnObject.h"
+#include "lldb/Utility/StructuredData.h"
+#include "lldb/lldb-forward.h"
+#include "llvm/ADT/StringExtras.h"
+#include "llvm/ADT/StringRef.h"
+
+namespace lldb_private {
+
+using SteadyTimePoint = std::chrono::time_point<std::chrono::steady_clock>;
----------------
jh7370 wrote:

Speaking from experience: `steady_clock` is only useful for measuring durations, since it isn't relative to a user's (or indeed any) fixed point in time - try converting it to a year/month/day etc format and you'll see what I mean. If you want an actual point in time that can be understood by the telemetry consumer, you'll need something to act as the base point of time that the steady times are relative to. In our internal telemetry implementation, our duration events therefore actually use both steady and system clock time points, with the reported duration being the difference between two steady time points, and the system clock time point being to indicate when the event was triggered.

https://github.com/llvm/llvm-project/pull/87815


More information about the lldb-commits mailing list