@@ -192,15 +192,15 @@ struct CommandTelemetryInfo : public LldbBaseTelemetryInfo {
192
192
std::string ToString () const override ;
193
193
};
194
194
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.
197
197
struct 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.
201
201
std::string target_uuid;
202
202
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
204
204
std::unordered_map<std::string, std::string> meta_data;
205
205
206
206
MiscTelemetryInfo () = default ;
@@ -223,29 +223,39 @@ struct MiscTelemetryInfo : public LldbBaseTelemetryInfo {
223
223
std::string ToString () const override ;
224
224
};
225
225
226
+ // / The base Telemeter instance in LLDB.
227
+ // / This class declares additional instrumentation points
228
+ // / applicable to LLDB.
226
229
class LldbTelemeter : public llvm ::telemetry::Telemeter {
227
230
public:
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);
229
239
230
240
virtual ~LldbTelemeter () = default ;
231
241
232
- // Invoked upon process exit
242
+ // / Invoked upon process exit
233
243
virtual void LogProcessExit (int status, llvm::StringRef exit_string,
234
244
llvm::telemetry::EventStats stats,
235
245
Target *target_ptr) = 0;
236
246
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.
240
250
virtual void
241
251
LogMainExecutableLoadStart (lldb::ModuleSP exec_mod,
242
252
llvm::telemetry::EventStats stats) = 0 ;
243
253
virtual void LogMainExecutableLoadEnd (lldb::ModuleSP exec_mod,
244
254
llvm::telemetry::EventStats stats) = 0;
245
255
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.
249
259
virtual void LogCommandStart (llvm::StringRef uuid,
250
260
llvm::StringRef original_command,
251
261
llvm::telemetry::EventStats stats,
@@ -258,36 +268,36 @@ class LldbTelemeter : public llvm::telemetry::Telemeter {
258
268
259
269
virtual std::string GetNextUUID () = 0;
260
270
261
- // For client (eg., SB API) to send telemetry entries.
271
+ // / For client (eg., SB API) to send telemetry entries.
262
272
virtual void
263
273
LogClientTelemetry (const lldb_private::StructuredDataImpl &entry) = 0 ;
264
274
};
265
275
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.
291
301
llvm::telemetry::Config *GetTelemetryConfig ();
292
302
293
303
} // namespace lldb_private
0 commit comments