[Lldb-commits] [lldb] Fix dap stacktrace perf issue (PR #104874)

via lldb-commits lldb-commits at lists.llvm.org
Fri Aug 23 19:09:01 PDT 2024


jeffreytan81 wrote:

And just for fun, here is an extreme one with 18 seconds of sampling time, 99.6% time is from this hot path. Note: they are all from linux machines because we only enable perf sampling by default for linux platform so we have no Mac data.

```
# time of first sample : 2646936.334980
# time of last sample : 2646954.518041
# sample duration :  18183.061 ms

    99.63%     0.00%  lldb-dap         lldb-dap              [.] main
            |
            ---main
               lldb_dap::DAP::Loop()
               lldb_dap::DAP::HandleObject(llvm::json::Object const&)
               (anonymous namespace)::request_stackTrace(llvm::json::Object const&)
               |
                --99.60%--lldb::SBThread::GetCurrentExceptionBacktrace()
                          lldb_private::Thread::GetCurrentExceptionBacktrace()
                          lldb_private::Thread::GetCurrentException()
                          lldb_private::ItaniumABILanguageRuntime::GetExceptionObjectForThread(std::shared_ptr<lldb_private::Thread>)
                          |
                           --99.60%--lldb_private::FunctionCaller::ExecuteFunction(lldb_private::ExecutionContext&, unsigned long*, lldb_private::EvaluateExpressionOptions const&, lldb_private::DiagnosticManager&, lldb_private::Value&)
                                     |
                                     |--44.33%--lldb_private::ClangFunctionCaller::CompileFunction(std::shared_ptr<lldb_private::Thread>, lldb_private::DiagnosticManager&)
                                     |          |
                                     |          |--39.56%--lldb_private::ClangExpressionParser::ParseInternal(lldb_private::DiagnosticManager&, clang::CodeCompleteConsumer*, unsigned int, unsigned int)
                                     |          |          |
                                     |          |          |--21.86%--clang::ParseAST(clang::Sema&, bool, bool)
                                     |          |          |          |
                                     |          |          |          |--17.47%--clang::Parser::ParseFirstTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&)
                                     |          |          |          |          clang::Parser::ParseTopLevelDecl(clang::OpaquePtr<clang::DeclGroupRef>&, clang::Sema::ModuleImportState&)
                                     |          |          |          |          clang::Parser::ParseExternalDeclaration(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*)
                                     |          |          |          |          clang::Parser::ParseDeclarationOrFunctionDefinition(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec*, clang::AccessSpecifier)
                                     |          |          |          |          clang::Parser::ParseDeclOrFunctionDefInternal(clang::ParsedAttributes&, clang::ParsedAttributes&, clang::ParsingDeclSpec&,
...
```

https://github.com/llvm/llvm-project/pull/104874


More information about the lldb-commits mailing list