Skip to content

Commit 4e9d65e

Browse files
committed
formatting + renaming
1 parent d7a554d commit 4e9d65e

File tree

2 files changed

+5
-11
lines changed

2 files changed

+5
-11
lines changed

lldb/include/lldb/Core/Telemetry.h

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -91,20 +91,16 @@ struct CommandInfo : public LLDBBaseTelemetryInfo {
9191
// and another right after. This is to avoid losing telemetry if the command
9292
// does not execute successfully.
9393
int command_id;
94-
9594
// Eg., "breakpoint set"
9695
std::string command_name;
97-
9896
// !!NOTE!! These two fields are not collected by default due to PII risks.
9997
// Vendor may allow them by setting the LLDBConfig::m_detailed_command_telemetry.
10098
std::string original_command;
10199
std::string args;
102-
103100
// Return status of a command and any error description in case of error.
104101
lldb::ReturnStatus ret_status;
105102
std::string error_data;
106103

107-
108104
CommandInfo() = default;
109105

110106
llvm::telemetry::KindType getKind() const override { return LLDBEntryKind::CommandInfo; }
@@ -115,7 +111,7 @@ struct CommandInfo : public LLDBBaseTelemetryInfo {
115111

116112
void serialize(Serializer &serializer) const override;
117113
};
118-
114+
119115
struct DebuggerInfo : public LLDBBaseTelemetryInfo {
120116
std::string lldb_version;
121117

@@ -188,11 +184,11 @@ template <typename Info> struct ScopedDispatcher {
188184

189185
void SetDebugger(Debugger *debugger) { debugger = debugger; }
190186

191-
void SetFinalCallback(llvm::unique_function<void(Info *info)> final_callback) {
187+
void DispatchOnExit(llvm::unique_function<void(Info *info)> final_callback) {
192188
m_final_callback(std::move(final_callback));
193189
}
194190

195-
void DispatchNowIfEnable(llvm::unique_function<void(Info *info)> populate_fields_cb) {
191+
void DispatchNow(llvm::unique_function<void(Info *info)> populate_fields_cb) {
196192
TelemetryManager *manager = TelemetryManager::GetInstanceIfEnabled();
197193
if (!manager)
198194
return;

lldb/source/Interpreter/CommandInterpreter.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1887,17 +1887,16 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
18871887
bool force_repeat_command) {
18881888
lldb_private::telemetry::ScopedDispatcher<
18891889
lldb_private::telemetry:CommandInfo> helper(m_debugger);
1890-
lldb_private::telemetry::TelemetryManager *ins = lldb_private::telemetry::TelemetryManager::GetInstanceOrDummy();
1890+
lldb_private::telemetry::TelemetryManager *ins = lldb_private::telemetry::TelemetryManager::GetInstance();
18911891
const int command_id = ins->MakeNextCommandId();
18921892

1893-
18941893
std::string command_string(command_line);
18951894
std::string original_command_string(command_string);
18961895
std::string real_original_command_string(command_string);
18971896
std::string parsed_command_args;
18981897
CommandObject *cmd_obj = nullptr;
18991898

1900-
helper.DispatchIfEnable([&](lldb_private::telemetry:CommandInfo* info){
1899+
helper.DispatchNow([&](lldb_private::telemetry:CommandInfo* info){
19011900
info.command_id = command_id;
19021901
if (Target* target = GetExecutionContext().GetTargetPtr()) {
19031902
// If we have a target attached to this command, then get the UUID.
@@ -1915,7 +1914,6 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
19151914
// TODO: this is logging the time the command-handler finishes.
19161915
// But we may want a finer-grain durations too?
19171916
// (ie., the execute_time recorded below?)
1918-
19191917
info.command_id = command_id;
19201918
llvm::StringRef command_name =
19211919
cmd_obj ? cmd_obj->GetCommandName() : "<not found>";

0 commit comments

Comments
 (0)