================
@@ -243,15 +243,33 @@ ModuleSP DynamicLoader::LoadBinaryWithUUIDAndAddress(
// find an executable and symbol file.
if (!module_sp) {
FileSpecList search_paths = Target::GetDefaultDebugFileSearchPaths();
- module_spec.GetSymbolFileSpec() =
- PluginManager::LocateExecutableSymbolFile(module_spec, search_paths);
- ModuleSpec objfile_module_spec =
- PluginManager::LocateExecutableObjectFile(module_spec);
+ StatsDuration symbol_duration;
+ std::string symbol_locator_name;
+ StatsDuration object_duration;
+ std::string object_locator_name;
+ ModuleSpec objfile_module_spec;
+ {
+ ElapsedTime elapsed(symbol_duration);
+ module_spec.GetSymbolFileSpec() =
+ PluginManager::LocateExecutableSymbolFile(module_spec,
search_paths,
+ &symbol_locator_name);
+ }
+ {
+ ElapsedTime elapsed(object_duration);
+ objfile_module_spec = PluginManager::LocateExecutableObjectFile(
+ module_spec, &object_locator_name);
+ }
----------------
clayborg wrote:
We should be passing in a `StatisticsMap` here and letting
`PluginManager::LocateExecutableSymbolFile` iterate over its items and timing
each one that tries to locate the executable so we know where the time was
spent. We want to be able to break down the time. If we have multiple
executable locators and the first one named "foo" takes 5 seconds and doesn't
find anything, and the second one named "bar" takes 1 second and it does find
the executable, we want a map that shows this breakdown if timings. This means
that the `ElapsedTime` stuff gets moved into
`PluginManager::LocateExecutableSymbolFile` around each plug-in call that tries
to locate the executable. So we don't need the `symbol_locator_name` variable,
and we should pass in a `StatisticsMap &stats_map`. It will be nice to change
the `PluginManager::LocateExecutableSymbolFile` API to take a `StatisticsMap
&stats_map` to force all clients of these calls to maintain the stats properly.
So just create a local StatisticsMap here and then pass it down to both calls.
All of this code really goes away and looks like:
```
StatisticsMap symbol_locator_map;
module_spec.GetSymbolFileSpec() =
PluginManager::LocateExecutableSymbolFile(module_spec, search_paths,
symbol_locator_map);
ModuleSpec objfile_module_spec =
PluginManager::LocateExecutableObjectFile(module_spec,
symbol_locator_map);
```
https://github.com/llvm/llvm-project/pull/134563
_______________________________________________
lldb-commits mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits