================
@@ -761,12 +767,29 @@ void Debugger::InstanceInitialize() {
 
 DebuggerSP Debugger::CreateInstance(lldb::LogOutputCallback log_callback,
                                     void *baton) {
+#ifdef LLVM_BUILD_TELEMETRY
+  lldb_private::telemetry::SteadyTimePoint start_time =
+      std::chrono::steady_clock::now();
+#endif
   DebuggerSP debugger_sp(new Debugger(log_callback, baton));
   if (g_debugger_list_ptr && g_debugger_list_mutex_ptr) {
     std::lock_guard<std::recursive_mutex> guard(*g_debugger_list_mutex_ptr);
     g_debugger_list_ptr->push_back(debugger_sp);
   }
   debugger_sp->InstanceInitialize();
+
+#ifdef LLVM_BUILD_TELEMETRY
+  if (auto *telemetry_manager = telemetry::TelemetryManager::getInstance()) {
+    if (telemetry_manager->getConfig()->EnableTelemetry) {
+      lldb_private::telemetry::DebuggerTelemetryInfo entry;
+      entry.start_time = start_time;
+      entry.end_time = std::chrono::steady_clock::now();
+      entry.debugger = debugger_sp.get();
+      telemetry_manager->atDebuggerStartup(&entry);
+    }
+  }
+#endif
----------------
JDevlieghere wrote:

When I introduced the CMake variable, I had something in mind like what we do 
for signposts on macOS (`LLVM_SUPPORT_XCODE_SIGNPOSTS`) where we have a wrapper 
and then compile out support when it's not available. Admittedly, that's not 
what I did by conditionalizing the library, so that's on me and I'm happy to 
rectify that. 

That said, as I'm seeing how this is actually used in practice, I'm not so sure 
of the benefit of compiling things out, so maybe keeping the CMake variable and 
making it so that it's impossible to turn on at runtime if the flag is set, is 
good enough. 

https://github.com/llvm/llvm-project/pull/127696
_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to