2323#include < atomic>
2424#include < chrono>
2525#include < ctime>
26- #include < functional>
2726#include < memory>
2827#include < optional>
2928#include < string>
30- #include < type_traits>
31- #include < utility>
3229
3330namespace lldb_private {
3431namespace telemetry {
@@ -49,18 +46,12 @@ struct LLDBConfig : public ::llvm::telemetry::Config {
4946// Specifically:
5047// - Length: 8 bits
5148// - First two bits (MSB) must be 11 - the common prefix
52- // - Last two bits (LSB) are reserved for grand-children of LLDBTelemetryInfo
5349// If any of the subclass has descendents, those descendents
54- // must have their LLDBEntryKind in the similar form (ie., share common prefix
55- // and differ by the last two bits)
50+ // must have their LLDBEntryKind in the similar form (ie., share common prefix)
5651struct LLDBEntryKind : public ::llvm::telemetry::EntryKind {
57- // clang-format off
58- static const llvm::telemetry::KindType BaseInfo = 0b11000000 ;
59- static const llvm::telemetry::KindType CommandInfo = 0b11010000 ;
60- static const llvm::telemetry::KindType DebuggerInfo = 0b11001000 ;
61- static const llvm::telemetry::KindType ExecModuleInfo = 0b11000100 ;
62- static const llvm::telemetry::KindType ProcessExitInfo = 0b11001100 ;
63- // clang-format on
52+ static const llvm::telemetry::KindType BaseInfo = 0b11000000 ;
53+ static const llvm::telemetry::KindType CommandInfo = 0b11010000 ;
54+ static const llvm::telemetry::KindType DebuggerInfo = 0b11000100 ;
6455};
6556
6657// / Defines a convenient type for timestamp of various events.
@@ -98,7 +89,7 @@ struct CommandInfo : public LLDBBaseTelemetryInfo {
9889 // / session. Necessary because we'd send off an entry right before a command's
9990 // / execution and another right after. This is to avoid losing telemetry if
10091 // / the command does not execute successfully.
101- uint64_t command_id = 0 ;
92+ uint64_t command_id;
10293 // / The command name(eg., "breakpoint set")
10394 std::string command_name;
10495 // / These two fields are not collected by default due to PII risks.
@@ -125,7 +116,7 @@ struct CommandInfo : public LLDBBaseTelemetryInfo {
125116
126117 void serialize (llvm::telemetry::Serializer &serializer) const override ;
127118
128- static uint64_t GetNextID ();
119+ static uint64_t GetNextId ();
129120
130121private:
131122 // We assign each command (in the same session) a unique id so that their
@@ -155,59 +146,6 @@ struct DebuggerInfo : public LLDBBaseTelemetryInfo {
155146 void serialize (llvm::telemetry::Serializer &serializer) const override ;
156147};
157148
158- struct ExecutableModuleInfo : public LLDBBaseTelemetryInfo {
159- lldb::ModuleSP exec_mod;
160- // / The same as the executable-module's UUID.
161- UUID uuid;
162- // / PID of the process owned by this target.
163- lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
164- // / The triple of this executable module.
165- std::string triple;
166-
167- // / If true, this entry was emitted at the beginning of an event (eg., before
168- // / the executable is set). Otherwise, it was emitted at the end of an
169- // / event (eg., after the module and any dependency were loaded.)
170- bool is_start_entry = false ;
171-
172- ExecutableModuleInfo () = default ;
173-
174- llvm::telemetry::KindType getKind () const override {
175- return LLDBEntryKind::ExecModuleInfo;
176- }
177-
178- static bool classof (const TelemetryInfo *T) {
179- // Subclasses of this is also acceptable
180- return (T->getKind () & LLDBEntryKind::ExecModuleInfo) ==
181- LLDBEntryKind::ExecModuleInfo;
182- }
183- void serialize (llvm::telemetry::Serializer &serializer) const override ;
184- };
185-
186- // / Describes an exit status.
187- struct ExitDescription {
188- int exit_code;
189- std::string description;
190- };
191-
192- struct ProcessExitInfo : public LLDBBaseTelemetryInfo {
193- // The executable-module's UUID.
194- UUID module_uuid;
195- lldb::pid_t pid = LLDB_INVALID_PROCESS_ID;
196- bool is_start_entry = false ;
197- std::optional<ExitDescription> exit_desc;
198-
199- llvm::telemetry::KindType getKind () const override {
200- return LLDBEntryKind::ProcessExitInfo;
201- }
202-
203- static bool classof (const TelemetryInfo *T) {
204- // Subclasses of this is also acceptable
205- return (T->getKind () & LLDBEntryKind::ProcessExitInfo) ==
206- LLDBEntryKind::ProcessExitInfo;
207- }
208- void serialize (llvm::telemetry::Serializer &serializer) const override ;
209- };
210-
211149// / The base Telemetry manager instance in LLDB.
212150// / This class declares additional instrumentation points
213151// / applicable to LLDB.
0 commit comments