diff options
author | jeffreytan81 <jeffreytan@meta.com> | 2024-02-05 13:17:29 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-02-05 13:17:29 -0800 |
commit | 76706090c2f672ae933798292bfa889f9e3dac3d (patch) | |
tree | d3466a91127635d5c46bbb7868fb17693784669b /lldb/source/Commands/CommandObjectCommands.cpp | |
parent | 4b6062619acf1cdc7b426520dd908d9fab70ed49 (diff) | |
download | llvm-76706090c2f672ae933798292bfa889f9e3dac3d.zip llvm-76706090c2f672ae933798292bfa889f9e3dac3d.tar.gz llvm-76706090c2f672ae933798292bfa889f9e3dac3d.tar.bz2 |
Add commands frequency to statistics dump (#80375)
Adding command interpreter statistics into "statistics dump" command so
that we can track the command usage frequency for telemetry purpose.
This is useful to answer questions like what is the most frequently used
lldb commands across all our users.
---------
Co-authored-by: jeffreytan81 <jeffreytan@fb.com>
Diffstat (limited to 'lldb/source/Commands/CommandObjectCommands.cpp')
-rw-r--r-- | lldb/source/Commands/CommandObjectCommands.cpp | 18 |
1 files changed, 11 insertions, 7 deletions
diff --git a/lldb/source/Commands/CommandObjectCommands.cpp b/lldb/source/Commands/CommandObjectCommands.cpp index 5b9af4a..a51e5ab 100644 --- a/lldb/source/Commands/CommandObjectCommands.cpp +++ b/lldb/source/Commands/CommandObjectCommands.cpp @@ -1123,6 +1123,8 @@ protected: CommandReturnObject &result) override { ScriptInterpreter *scripter = GetDebugger().GetScriptInterpreter(); + m_interpreter.IncreaseCommandUsage(*this); + Status error; result.SetStatus(eReturnStatusInvalid); @@ -1644,8 +1646,9 @@ protected: llvm::Error llvm_error = m_container->LoadUserSubcommand(m_cmd_name, new_cmd_sp, m_overwrite); if (llvm_error) - result.AppendErrorWithFormat("cannot add command: %s", - llvm::toString(std::move(llvm_error)).c_str()); + result.AppendErrorWithFormat( + "cannot add command: %s", + llvm::toString(std::move(llvm_error)).c_str()); } } @@ -1788,12 +1791,13 @@ protected: return; } const char *leaf_cmd = command[num_args - 1].c_str(); - llvm::Error llvm_error = container->RemoveUserSubcommand(leaf_cmd, - /* multiword not okay */ false); + llvm::Error llvm_error = + container->RemoveUserSubcommand(leaf_cmd, + /* multiword not okay */ false); if (llvm_error) { - result.AppendErrorWithFormat("could not delete command '%s': %s", - leaf_cmd, - llvm::toString(std::move(llvm_error)).c_str()); + result.AppendErrorWithFormat( + "could not delete command '%s': %s", leaf_cmd, + llvm::toString(std::move(llvm_error)).c_str()); return; } |