[lldb] [llvm] [lldb]Implement LLDB Telemetry (PR #98528)
Pavel Labath via llvm-commits
llvm-commits at lists.llvm.org
Thu Sep 19 06:30:38 PDT 2024
================
@@ -682,17 +683,51 @@ PacketStatus DAP::GetNextObject(llvm::json::Object &object) {
}
bool DAP::HandleObject(const llvm::json::Object &object) {
+ auto start_time = std::chrono::steady_clock::now();
const auto packet_type = GetString(object, "type");
if (packet_type == "request") {
const auto command = GetString(object, "command");
auto handler_pos = request_handlers.find(std::string(command));
+ lldb::SBStructuredData telemetry_entry;
+
+ // There does not seem to be a direct way to construct an SBStructuredData.
+ // So we first create a json::Array object,
+ // then we serialize it to a string,
+ // and finally call SBStructuredData::SetFromJSON(string).
+ //
+ // TODO: This seems unnecessarily complex. Ideally, we should be able to
----------------
labath wrote:
Not exactly, since "(SB)StructuredData" is not really JSON, but an abstract representation of structured data (which "happens" to look a lot like json).
The only alternative I see is to add the ability to construct/mutate SBStructuredData directly (all the existing APIs are just getters, probably because our structured data usually flows in the other direction). I think this kind of functionality would make sense from an API perspective, but maybe it's not worth doing it for the sake of this patch.
https://github.com/llvm/llvm-project/pull/98528
More information about the llvm-commits
mailing list