diff options
| author | Greg Clayton <gclayton@apple.com> | 2012-01-09 23:59:30 +0000 |
|---|---|---|
| committer | Greg Clayton <gclayton@apple.com> | 2012-01-09 23:59:30 +0000 |
| commit | aecb12b5c648912efa2f8591c8bedb77b7e6a712 (patch) | |
| tree | 46e3ae7089533827e54e263672fe721de6c4a470 /lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp | |
| parent | 7f21bd74b8655a6fbe61ddfc2322b7bc8c302339 (diff) | |
| download | bcm5719-llvm-aecb12b5c648912efa2f8591c8bedb77b7e6a712.tar.gz bcm5719-llvm-aecb12b5c648912efa2f8591c8bedb77b7e6a712.zip | |
Make a log timer for the BSD archive creation so we can track the time it
takes to open and index BSD archives.
llvm-svn: 147813
Diffstat (limited to 'lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp')
| -rw-r--r-- | lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp | 41 |
1 files changed, 25 insertions, 16 deletions
diff --git a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp index ec019093eed..207419c077d 100644 --- a/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp +++ b/lldb/source/Plugins/ObjectContainer/BSD-Archive/ObjectContainerBSDArchive.cpp @@ -16,6 +16,7 @@ #include "lldb/Core/Module.h" #include "lldb/Core/PluginManager.h" #include "lldb/Core/RegularExpression.h" +#include "lldb/Core/Timer.h" #include "lldb/Host/Mutex.h" #include "lldb/Symbol/ObjectFile.h" @@ -265,31 +266,39 @@ ObjectContainerBSDArchive::CreateInstance Module* module, DataBufferSP& data_sp, const FileSpec *file, - addr_t offset, - addr_t length) + addr_t file_offset, + addr_t file_size) { if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data_sp)) { - Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module->GetArchitecture(), module->GetModificationTime())); - - if (archive_sp) + Timer scoped_timer (__PRETTY_FUNCTION__, + "ObjectContainerBSDArchive::CreateInstance (module = %s/%s, file = %p, file_offset = 0x%z8.8x, file_size = 0x%z8.8x)", + module->GetFileSpec().GetDirectory().AsCString(), + module->GetFileSpec().GetFilename().AsCString(), + file, file_offset, file_size); + + std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, data_sp, file, file_offset, file_size)); + + if (container_ap.get()) { - // We already have this archive in our cache, use it - std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length)); - if (container_ap.get()) + Archive::shared_ptr archive_sp (Archive::FindCachedArchive (*file, module->GetArchitecture(), module->GetModificationTime())); + + if (archive_sp) { + // We already have this archive in our cache, use it container_ap->SetArchive (archive_sp); return container_ap.release(); } + else + { + // Read everything since we need that in order to index all the + // objects in the archive + data_sp = file->MemoryMapFileContents (file_offset, file_size); + + if (container_ap->ParseHeader()) + return container_ap.release(); + } } - - // Read everything since we need that in order to index all the - // objects in the archive - data_sp = file->MemoryMapFileContents (offset, length); - - std::auto_ptr<ObjectContainerBSDArchive> container_ap(new ObjectContainerBSDArchive (module, data_sp, file, offset, length)); - if (container_ap->ParseHeader()) - return container_ap.release(); } return NULL; } |

