@@ -192,15 +192,15 @@ struct CommandTelemetryInfo : public LldbBaseTelemetryInfo {
192192 std::string ToString () const override ;
193193};
194194
195- // The "catch-all" entry to store a set of custom/non-standard
196- // data.
195+ // / The "catch-all" entry to store a set of custom/non-standard
196+ // / data.
197197struct MiscTelemetryInfo : public LldbBaseTelemetryInfo {
198- // If the event is/can be associated with a target entry,
199- // this field contains that target's UUID.
200- // <EMPTY> otherwise.
198+ // / If the event is/can be associated with a target entry,
199+ // / this field contains that target's UUID.
200+ // / <EMPTY> otherwise.
201201 std::string target_uuid;
202202
203- // Set of key-value pairs for any optional (or impl-specific) data
203+ // / Set of key-value pairs for any optional (or impl-specific) data
204204 std::unordered_map<std::string, std::string> meta_data;
205205
206206 MiscTelemetryInfo () = default ;
@@ -223,29 +223,39 @@ struct MiscTelemetryInfo : public LldbBaseTelemetryInfo {
223223 std::string ToString () const override ;
224224};
225225
226+ // / The base Telemeter instance in LLDB.
227+ // / This class declares additional instrumentation points
228+ // / applicable to LLDB.
226229class LldbTelemeter : public llvm ::telemetry::Telemeter {
227230public:
228- static std::unique_ptr<LldbTelemeter> CreateInstance (Debugger *);
231+ // / Creates an instance of LldbTelemeter.
232+ // / This uses the plugin registry to find an instance:
233+ // / - If a vendor supplies a implementation, it will use it.
234+ // / - If not, it will either return a no-op instance or a basic
235+ // / implementation for testing.
236+ // /
237+ // / See also lldb_private::TelemetryVendor.
238+ static std::unique_ptr<LldbTelemeter> CreateInstance (Debugger *debugger);
229239
230240 virtual ~LldbTelemeter () = default ;
231241
232- // Invoked upon process exit
242+ // / Invoked upon process exit
233243 virtual void LogProcessExit (int status, llvm::StringRef exit_string,
234244 llvm::telemetry::EventStats stats,
235245 Target *target_ptr) = 0;
236246
237- // Invoked upon loading the main executable module
238- // We log in a fire-n-forget fashion so that if the load
239- // crashes, we don't lose the entry.
247+ // / Invoked upon loading the main executable module
248+ // / We log in a fire-n-forget fashion so that if the load
249+ // / crashes, we don't lose the entry.
240250 virtual void
241251 LogMainExecutableLoadStart (lldb::ModuleSP exec_mod,
242252 llvm::telemetry::EventStats stats) = 0 ;
243253 virtual void LogMainExecutableLoadEnd (lldb::ModuleSP exec_mod,
244254 llvm::telemetry::EventStats stats) = 0;
245255
246- // Invoked for each command
247- // We log in a fire-n-forget fashion so that if the command execution
248- // crashes, we don't lose the entry.
256+ // / Invoked for each command
257+ // / We log in a fire-n-forget fashion so that if the command execution
258+ // / crashes, we don't lose the entry.
249259 virtual void LogCommandStart (llvm::StringRef uuid,
250260 llvm::StringRef original_command,
251261 llvm::telemetry::EventStats stats,
@@ -258,36 +268,36 @@ class LldbTelemeter : public llvm::telemetry::Telemeter {
258268
259269 virtual std::string GetNextUUID () = 0;
260270
261- // For client (eg., SB API) to send telemetry entries.
271+ // / For client (eg., SB API) to send telemetry entries.
262272 virtual void
263273 LogClientTelemetry (const lldb_private::StructuredDataImpl &entry) = 0 ;
264274};
265275
266- // Logger configs: LLDB users can also supply their own configs via:
267- // $HOME/.lldb_telemetry_config
268- //
269- // We can propose simple syntax: <field_name><colon><value>
270- // Eg.,
271- // enable_telemetry:true
272- // destination:stdout
273- // destination:stderr
274- // destination:/path/to/some/file
275- //
276- // The allowed field_name values are:
277- // * enable_telemetry
278- // If the fields are specified more than once, the last line will take
279- // precedence If enable_logging is set to false, no logging will occur.
280- // * destination.
281- // This is allowed to be specified multiple times - it will add to the
282- // default (ie, specified by vendor) list of destinations.
283- // The value can be either:
284- // + one of the two magic values "stdout" or "stderr".
285- // + a path to a local file
286- // !!NOTE!!: We decided to use a separate file instead of the existing settings
287- // file because that file is parsed too late in the process and by the
288- // there might have been lots of telemetry-entries that need to be
289- // sent already.
290- // This approach avoid losing log entries if LLDB crashes during init.
276+ // / Logger configs: LLDB users can also supply their own configs via:
277+ // / $HOME/.lldb_telemetry_config
278+ // /
279+ // / We can propose simple syntax: <field_name><colon><value>
280+ // / Eg.,
281+ // / enable_telemetry:true
282+ // / destination:stdout
283+ // / destination:stderr
284+ // / destination:/path/to/some/file
285+ // /
286+ // / The allowed field_name values are:
287+ // / * enable_telemetry
288+ // / If the fields are specified more than once, the last line will take
289+ // / precedence If enable_logging is set to false, no logging will occur.
290+ // / * destination.
291+ // / This is allowed to be specified multiple times - it will add to the
292+ // / default (ie, specified by vendor) list of destinations.
293+ // / The value can be either:
294+ // / + one of the two magic values "stdout" or "stderr".
295+ // / + a path to a local file
296+ // / !!NOTE!!: We decided to use a separate file instead of the existing settings
297+ // / file because that file is parsed too late in the process and by the
298+ // / there might have been lots of telemetry-entries that need to be
299+ // / sent already.
300+ // / This approach avoid losing log entries if LLDB crashes during init.
291301llvm::telemetry::Config *GetTelemetryConfig ();
292302
293303} // namespace lldb_private
0 commit comments