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/API/SBCommandInterpreter.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/API/SBCommandInterpreter.cpp')
-rw-r--r-- | lldb/source/API/SBCommandInterpreter.cpp | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/lldb/source/API/SBCommandInterpreter.cpp b/lldb/source/API/SBCommandInterpreter.cpp index c3cbb00..7b87dc5 100644 --- a/lldb/source/API/SBCommandInterpreter.cpp +++ b/lldb/source/API/SBCommandInterpreter.cpp @@ -557,6 +557,19 @@ bool SBCommandInterpreter::SetCommandOverrideCallback( return false; } +SBStructuredData SBCommandInterpreter::GetStatistics() { + LLDB_INSTRUMENT_VA(this); + + SBStructuredData data; + if (!IsValid()) + return data; + + std::string json_str = + llvm::formatv("{0:2}", m_opaque_ptr->GetStatistics()).str(); + data.m_impl_up->SetObjectSP(StructuredData::ParseJSON(json_str)); + return data; +} + lldb::SBCommand SBCommandInterpreter::AddMultiwordCommand(const char *name, const char *help) { LLDB_INSTRUMENT_VA(this, name, help); |