[lldb] Questions about ElapsedTime

I’m looking for ways to measure LLDB time on various tasks and found ElapsedTime.

ElapsedTime is able to accumulate the time spent on different functions to give a more meaningful time measurement for a given task, like parsing debug info for each module. I only find 4 functions where m_parse_time is used to get the time spent them in SymbolFileDWARF.cpp: SymbolFileDWARF::ParseSupportFiles, SymbolFileDWARF::GetTypeUnitSupportFiles, SymbolFileDWARF::ParseLineTable and SymbolFileDWARF::ParseDebugMacros.

It’s not used in SymbolFileDWARF::ParseTypes and other SymbolFileDWARF::Parse* functions. Is it because Parse* functions are already invoked directly or indirectly from the 4 functions above? If not, we might missing some time measurement spent on parse debug info. This might also be true to some other tasks measured with ElapsedTime. Is there a good way to ensure the times spent on the functions are properly included as part of the tasks we are measuring?

From a quick glance I think the key function that uses m_parse_time (via a getter) is:

void DWARFUnit::ExtractDIEsRWLocked() {
  llvm::sys::ScopedWriter first_die_lock(m_first_die_mutex);

  ElapsedTime elapsed(m_dwarf.GetDebugInfoParseTimeRef());

Which is the entry point to a lot of the DIE parsing

1 Like