forked from OSchip/llvm-project
Remove an expensive lock from Timer
The Timer destructor would grab a global mutex in order to update execution time. Add a class to define a category once, statically; the class adds itself to an atomic singly linked list, and thus subsequent updates only need to use an atomic rather than grab a lock and perform a hashtable lookup. Differential Revision: https://reviews.llvm.org/D32823 Patch by Scott Smith <scott.smith@purestorage.com>. llvm-svn: 303058
This commit is contained in:
parent
3030bf0c81
commit
f9d1647657
|
@ -37,10 +37,23 @@ namespace lldb_private {
|
||||||
|
|
||||||
class Timer {
|
class Timer {
|
||||||
public:
|
public:
|
||||||
|
class Category {
|
||||||
|
public:
|
||||||
|
explicit Category(const char *category_name);
|
||||||
|
|
||||||
|
private:
|
||||||
|
friend class Timer;
|
||||||
|
const char *m_name;
|
||||||
|
std::atomic<uint64_t> m_nanos;
|
||||||
|
std::atomic<Category *> m_next;
|
||||||
|
|
||||||
|
DISALLOW_COPY_AND_ASSIGN(Category);
|
||||||
|
};
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
/// Default constructor.
|
/// Default constructor.
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
Timer(const char *category, const char *format, ...)
|
Timer(Category &category, const char *format, ...)
|
||||||
__attribute__((format(printf, 3, 4)));
|
__attribute__((format(printf, 3, 4)));
|
||||||
|
|
||||||
//--------------------------------------------------------------
|
//--------------------------------------------------------------
|
||||||
|
@ -62,7 +75,7 @@ protected:
|
||||||
using TimePoint = std::chrono::steady_clock::time_point;
|
using TimePoint = std::chrono::steady_clock::time_point;
|
||||||
void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; }
|
void ChildDuration(TimePoint::duration dur) { m_child_duration += dur; }
|
||||||
|
|
||||||
const char *m_category;
|
Category &m_category;
|
||||||
TimePoint m_total_start;
|
TimePoint m_total_start;
|
||||||
TimePoint::duration m_child_duration{0};
|
TimePoint::duration m_child_duration{0};
|
||||||
|
|
||||||
|
|
|
@ -400,7 +400,8 @@ void SystemInitializerFull::InitializeSWIG() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemInitializerFull::Terminate() {
|
void SystemInitializerFull::Terminate() {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
Debugger::SettingsTerminate();
|
Debugger::SettingsTerminate();
|
||||||
|
|
||||||
|
|
|
@ -269,8 +269,8 @@ protected:
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *file_path = command.GetArgumentAtIndex(0);
|
const char *file_path = command.GetArgumentAtIndex(0);
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "(lldb) target create '%s'",
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
file_path);
|
Timer scoped_timer(func_cat, "(lldb) target create '%s'", file_path);
|
||||||
FileSpec file_spec;
|
FileSpec file_spec;
|
||||||
|
|
||||||
if (file_path)
|
if (file_path)
|
||||||
|
|
|
@ -59,7 +59,8 @@ using namespace lldb_private;
|
||||||
DisassemblerSP Disassembler::FindPlugin(const ArchSpec &arch,
|
DisassemblerSP Disassembler::FindPlugin(const ArchSpec &arch,
|
||||||
const char *flavor,
|
const char *flavor,
|
||||||
const char *plugin_name) {
|
const char *plugin_name) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"Disassembler::FindPlugin (arch = %s, plugin_name = %s)",
|
"Disassembler::FindPlugin (arch = %s, plugin_name = %s)",
|
||||||
arch.GetArchitectureName(), plugin_name);
|
arch.GetArchitectureName(), plugin_name);
|
||||||
|
|
||||||
|
@ -1460,4 +1461,3 @@ std::function<bool(const Instruction::Operand &)>
|
||||||
lldb_private::OperandMatchers::MatchOpType(Instruction::Operand::Type type) {
|
lldb_private::OperandMatchers::MatchOpType(Instruction::Operand::Type type) {
|
||||||
return [type](const Instruction::Operand &op) { return op.m_type == type; };
|
return [type](const Instruction::Operand &op) { return op.m_type == type; };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -258,8 +258,8 @@ Mangled::GetDemangledName(lldb::LanguageType language) const {
|
||||||
// haven't already decoded our mangled name.
|
// haven't already decoded our mangled name.
|
||||||
if (m_mangled && !m_demangled) {
|
if (m_mangled && !m_demangled) {
|
||||||
// We need to generate and cache the demangled name.
|
// We need to generate and cache the demangled name.
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"Mangled::GetDemangledName (m_mangled = %s)",
|
Timer scoped_timer(func_cat, "Mangled::GetDemangledName (m_mangled = %s)",
|
||||||
m_mangled.GetCString());
|
m_mangled.GetCString());
|
||||||
|
|
||||||
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE);
|
Log *log = lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_DEMANGLE);
|
||||||
|
|
|
@ -429,8 +429,8 @@ void Module::DumpSymbolContext(Stream *s) {
|
||||||
|
|
||||||
size_t Module::GetNumCompileUnits() {
|
size_t Module::GetNumCompileUnits() {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"Module::GetNumCompileUnits (module = %p)",
|
Timer scoped_timer(func_cat, "Module::GetNumCompileUnits (module = %p)",
|
||||||
static_cast<void *>(this));
|
static_cast<void *>(this));
|
||||||
SymbolVendor *symbols = GetSymbolVendor();
|
SymbolVendor *symbols = GetSymbolVendor();
|
||||||
if (symbols)
|
if (symbols)
|
||||||
|
@ -453,7 +453,8 @@ CompUnitSP Module::GetCompileUnitAtIndex(size_t index) {
|
||||||
|
|
||||||
bool Module::ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) {
|
bool Module::ResolveFileAddress(lldb::addr_t vm_addr, Address &so_addr) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")",
|
"Module::ResolveFileAddress (vm_addr = 0x%" PRIx64 ")",
|
||||||
vm_addr);
|
vm_addr);
|
||||||
SectionList *section_list = GetSectionList();
|
SectionList *section_list = GetSectionList();
|
||||||
|
@ -616,7 +617,8 @@ uint32_t Module::ResolveSymbolContextsForFileSpec(const FileSpec &file_spec,
|
||||||
uint32_t resolve_scope,
|
uint32_t resolve_scope,
|
||||||
SymbolContextList &sc_list) {
|
SymbolContextList &sc_list) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"Module::ResolveSymbolContextForFilePath (%s:%u, "
|
"Module::ResolveSymbolContextForFilePath (%s:%u, "
|
||||||
"check_inlines = %s, resolve_scope = 0x%8.8x)",
|
"check_inlines = %s, resolve_scope = 0x%8.8x)",
|
||||||
file_spec.GetPath().c_str(), line,
|
file_spec.GetPath().c_str(), line,
|
||||||
|
@ -987,7 +989,8 @@ size_t Module::FindTypes_Impl(
|
||||||
const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches,
|
const CompilerDeclContext *parent_decl_ctx, bool append, size_t max_matches,
|
||||||
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
llvm::DenseSet<lldb_private::SymbolFile *> &searched_symbol_files,
|
||||||
TypeMap &types) {
|
TypeMap &types) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
if (!sc.module_sp || sc.module_sp.get() == this) {
|
if (!sc.module_sp || sc.module_sp.get() == this) {
|
||||||
SymbolVendor *symbols = GetSymbolVendor();
|
SymbolVendor *symbols = GetSymbolVendor();
|
||||||
if (symbols)
|
if (symbols)
|
||||||
|
@ -1078,7 +1081,8 @@ SymbolVendor *Module::GetSymbolVendor(bool can_create,
|
||||||
if (!m_did_load_symbol_vendor.load() && can_create) {
|
if (!m_did_load_symbol_vendor.load() && can_create) {
|
||||||
ObjectFile *obj_file = GetObjectFile();
|
ObjectFile *obj_file = GetObjectFile();
|
||||||
if (obj_file != nullptr) {
|
if (obj_file != nullptr) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
m_symfile_ap.reset(
|
m_symfile_ap.reset(
|
||||||
SymbolVendor::FindPlugin(shared_from_this(), feedback_strm));
|
SymbolVendor::FindPlugin(shared_from_this(), feedback_strm));
|
||||||
m_did_load_symbol_vendor = true;
|
m_did_load_symbol_vendor = true;
|
||||||
|
@ -1278,8 +1282,8 @@ ObjectFile *Module::GetObjectFile() {
|
||||||
if (!m_did_load_objfile.load()) {
|
if (!m_did_load_objfile.load()) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
if (!m_did_load_objfile.load()) {
|
if (!m_did_load_objfile.load()) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"Module::GetObjectFile () module = %s",
|
Timer scoped_timer(func_cat, "Module::GetObjectFile () module = %s",
|
||||||
GetFileSpec().GetFilename().AsCString(""));
|
GetFileSpec().GetFilename().AsCString(""));
|
||||||
DataBufferSP data_sp;
|
DataBufferSP data_sp;
|
||||||
lldb::offset_t data_offset = 0;
|
lldb::offset_t data_offset = 0;
|
||||||
|
@ -1338,9 +1342,9 @@ SectionList *Module::GetUnifiedSectionList() {
|
||||||
|
|
||||||
const Symbol *Module::FindFirstSymbolWithNameAndType(const ConstString &name,
|
const Symbol *Module::FindFirstSymbolWithNameAndType(const ConstString &name,
|
||||||
SymbolType symbol_type) {
|
SymbolType symbol_type) {
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat, "Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)",
|
||||||
"Module::FindFirstSymbolWithNameAndType (name = %s, type = %i)",
|
|
||||||
name.AsCString(), symbol_type);
|
name.AsCString(), symbol_type);
|
||||||
SymbolVendor *sym_vendor = GetSymbolVendor();
|
SymbolVendor *sym_vendor = GetSymbolVendor();
|
||||||
if (sym_vendor) {
|
if (sym_vendor) {
|
||||||
|
@ -1372,7 +1376,8 @@ void Module::SymbolIndicesToSymbolContextList(
|
||||||
size_t Module::FindFunctionSymbols(const ConstString &name,
|
size_t Module::FindFunctionSymbols(const ConstString &name,
|
||||||
uint32_t name_type_mask,
|
uint32_t name_type_mask,
|
||||||
SymbolContextList &sc_list) {
|
SymbolContextList &sc_list) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)",
|
"Module::FindSymbolsFunctions (name = %s, mask = 0x%8.8x)",
|
||||||
name.AsCString(), name_type_mask);
|
name.AsCString(), name_type_mask);
|
||||||
SymbolVendor *sym_vendor = GetSymbolVendor();
|
SymbolVendor *sym_vendor = GetSymbolVendor();
|
||||||
|
@ -1390,9 +1395,9 @@ size_t Module::FindSymbolsWithNameAndType(const ConstString &name,
|
||||||
// No need to protect this call using m_mutex all other method calls are
|
// No need to protect this call using m_mutex all other method calls are
|
||||||
// already thread safe.
|
// already thread safe.
|
||||||
|
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat, "Module::FindSymbolsWithNameAndType (name = %s, type = %i)",
|
||||||
"Module::FindSymbolsWithNameAndType (name = %s, type = %i)",
|
|
||||||
name.AsCString(), symbol_type);
|
name.AsCString(), symbol_type);
|
||||||
const size_t initial_size = sc_list.GetSize();
|
const size_t initial_size = sc_list.GetSize();
|
||||||
SymbolVendor *sym_vendor = GetSymbolVendor();
|
SymbolVendor *sym_vendor = GetSymbolVendor();
|
||||||
|
@ -1413,8 +1418,9 @@ size_t Module::FindSymbolsMatchingRegExAndType(const RegularExpression ®ex,
|
||||||
// No need to protect this call using m_mutex all other method calls are
|
// No need to protect this call using m_mutex all other method calls are
|
||||||
// already thread safe.
|
// already thread safe.
|
||||||
|
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat,
|
||||||
"Module::FindSymbolsMatchingRegExAndType (regex = %s, type = %i)",
|
"Module::FindSymbolsMatchingRegExAndType (regex = %s, type = %i)",
|
||||||
regex.GetText().str().c_str(), symbol_type);
|
regex.GetText().str().c_str(), symbol_type);
|
||||||
const size_t initial_size = sc_list.GetSize();
|
const size_t initial_size = sc_list.GetSize();
|
||||||
|
|
|
@ -27,8 +27,8 @@ using namespace lldb_private;
|
||||||
#define TIMER_INDENT_AMOUNT 2
|
#define TIMER_INDENT_AMOUNT 2
|
||||||
|
|
||||||
namespace {
|
namespace {
|
||||||
typedef std::map<const char *, std::chrono::nanoseconds> TimerCategoryMap;
|
|
||||||
typedef std::vector<Timer *> TimerStack;
|
typedef std::vector<Timer *> TimerStack;
|
||||||
|
static std::atomic<Timer::Category *> g_categories;
|
||||||
} // end of anonymous namespace
|
} // end of anonymous namespace
|
||||||
|
|
||||||
std::atomic<bool> Timer::g_quiet(true);
|
std::atomic<bool> Timer::g_quiet(true);
|
||||||
|
@ -38,16 +38,6 @@ static std::mutex &GetFileMutex() {
|
||||||
return *g_file_mutex_ptr;
|
return *g_file_mutex_ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
static std::mutex &GetCategoryMutex() {
|
|
||||||
static std::mutex g_category_mutex;
|
|
||||||
return g_category_mutex;
|
|
||||||
}
|
|
||||||
|
|
||||||
static TimerCategoryMap &GetCategoryMap() {
|
|
||||||
static TimerCategoryMap g_category_map;
|
|
||||||
return g_category_map;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void ThreadSpecificCleanup(void *p) {
|
static void ThreadSpecificCleanup(void *p) {
|
||||||
delete static_cast<TimerStack *>(p);
|
delete static_cast<TimerStack *>(p);
|
||||||
}
|
}
|
||||||
|
@ -64,9 +54,17 @@ static TimerStack *GetTimerStackForCurrentThread() {
|
||||||
return (TimerStack *)timer_stack;
|
return (TimerStack *)timer_stack;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Timer::Category::Category(const char *cat) : m_name(cat) {
|
||||||
|
m_nanos.store(0, std::memory_order_release);
|
||||||
|
Category *expected = g_categories;
|
||||||
|
do {
|
||||||
|
m_next = expected;
|
||||||
|
} while (!g_categories.compare_exchange_weak(expected, this));
|
||||||
|
}
|
||||||
|
|
||||||
void Timer::SetQuiet(bool value) { g_quiet = value; }
|
void Timer::SetQuiet(bool value) { g_quiet = value; }
|
||||||
|
|
||||||
Timer::Timer(const char *category, const char *format, ...)
|
Timer::Timer(Timer::Category &category, const char *format, ...)
|
||||||
: m_category(category), m_total_start(std::chrono::steady_clock::now()) {
|
: m_category(category), m_total_start(std::chrono::steady_clock::now()) {
|
||||||
TimerStack *stack = GetTimerStackForCurrentThread();
|
TimerStack *stack = GetTimerStackForCurrentThread();
|
||||||
if (!stack)
|
if (!stack)
|
||||||
|
@ -114,11 +112,7 @@ Timer::~Timer() {
|
||||||
stack->back()->ChildDuration(total_dur);
|
stack->back()->ChildDuration(total_dur);
|
||||||
|
|
||||||
// Keep total results for each category so we can dump results.
|
// Keep total results for each category so we can dump results.
|
||||||
{
|
m_category.m_nanos += std::chrono::nanoseconds(timer_dur).count();
|
||||||
std::lock_guard<std::mutex> guard(GetCategoryMutex());
|
|
||||||
TimerCategoryMap &category_map = GetCategoryMap();
|
|
||||||
category_map[m_category] += timer_dur;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; }
|
void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; }
|
||||||
|
@ -126,33 +120,32 @@ void Timer::SetDisplayDepth(uint32_t depth) { g_display_depth = depth; }
|
||||||
/* binary function predicate:
|
/* binary function predicate:
|
||||||
* - returns whether a person is less than another person
|
* - returns whether a person is less than another person
|
||||||
*/
|
*/
|
||||||
static bool
|
|
||||||
CategoryMapIteratorSortCriterion(const TimerCategoryMap::const_iterator &lhs,
|
typedef std::pair<const char *, uint64_t> TimerEntry;
|
||||||
const TimerCategoryMap::const_iterator &rhs) {
|
|
||||||
return lhs->second > rhs->second;
|
static bool CategoryMapIteratorSortCriterion(const TimerEntry &lhs,
|
||||||
|
const TimerEntry &rhs) {
|
||||||
|
return lhs.second > rhs.second;
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::ResetCategoryTimes() {
|
void Timer::ResetCategoryTimes() {
|
||||||
std::lock_guard<std::mutex> guard(GetCategoryMutex());
|
for (Category *i = g_categories; i; i = i->m_next)
|
||||||
TimerCategoryMap &category_map = GetCategoryMap();
|
i->m_nanos.store(0, std::memory_order_release);
|
||||||
category_map.clear();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void Timer::DumpCategoryTimes(Stream *s) {
|
void Timer::DumpCategoryTimes(Stream *s) {
|
||||||
std::lock_guard<std::mutex> guard(GetCategoryMutex());
|
std::vector<TimerEntry> sorted;
|
||||||
TimerCategoryMap &category_map = GetCategoryMap();
|
for (Category *i = g_categories; i; i = i->m_next) {
|
||||||
std::vector<TimerCategoryMap::const_iterator> sorted_iterators;
|
uint64_t nanos = i->m_nanos.load(std::memory_order_acquire);
|
||||||
TimerCategoryMap::const_iterator pos, end = category_map.end();
|
if (nanos)
|
||||||
for (pos = category_map.begin(); pos != end; ++pos) {
|
sorted.push_back(std::make_pair(i->m_name, nanos));
|
||||||
sorted_iterators.push_back(pos);
|
|
||||||
}
|
}
|
||||||
std::sort(sorted_iterators.begin(), sorted_iterators.end(),
|
if (sorted.empty())
|
||||||
CategoryMapIteratorSortCriterion);
|
return; // Later code will break without any elements.
|
||||||
|
|
||||||
const size_t count = sorted_iterators.size();
|
// Sort by time
|
||||||
for (size_t i = 0; i < count; ++i) {
|
std::sort(sorted.begin(), sorted.end(), CategoryMapIteratorSortCriterion);
|
||||||
const auto timer = sorted_iterators[i]->second;
|
|
||||||
s->Printf("%.9f sec for %s\n", std::chrono::duration<double>(timer).count(),
|
for (const auto &timer : sorted)
|
||||||
sorted_iterators[i]->first);
|
s->Printf("%.9f sec for %s\n", timer.second / 1000000000., timer.first);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -151,8 +151,9 @@ FileSpec LocateExecutableSymbolFileDsym(const ModuleSpec &module_spec) {
|
||||||
const ArchSpec *arch = module_spec.GetArchitecturePtr();
|
const ArchSpec *arch = module_spec.GetArchitecturePtr();
|
||||||
const UUID *uuid = module_spec.GetUUIDPtr();
|
const UUID *uuid = module_spec.GetUUIDPtr();
|
||||||
|
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat,
|
||||||
"LocateExecutableSymbolFileDsym (file = %s, arch = %s, uuid = %p)",
|
"LocateExecutableSymbolFileDsym (file = %s, arch = %s, uuid = %p)",
|
||||||
exec_fspec ? exec_fspec->GetFilename().AsCString("<NULL>") : "<NULL>",
|
exec_fspec ? exec_fspec->GetFilename().AsCString("<NULL>") : "<NULL>",
|
||||||
arch ? arch->GetArchitectureName() : "<NULL>", (const void *)uuid);
|
arch ? arch->GetArchitectureName() : "<NULL>", (const void *)uuid);
|
||||||
|
@ -175,9 +176,9 @@ ModuleSpec Symbols::LocateExecutableObjectFile(const ModuleSpec &module_spec) {
|
||||||
const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
|
const FileSpec *exec_fspec = module_spec.GetFileSpecPtr();
|
||||||
const ArchSpec *arch = module_spec.GetArchitecturePtr();
|
const ArchSpec *arch = module_spec.GetArchitecturePtr();
|
||||||
const UUID *uuid = module_spec.GetUUIDPtr();
|
const UUID *uuid = module_spec.GetUUIDPtr();
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat, "LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
|
||||||
"LocateExecutableObjectFile (file = %s, arch = %s, uuid = %p)",
|
|
||||||
exec_fspec ? exec_fspec->GetFilename().AsCString("<NULL>") : "<NULL>",
|
exec_fspec ? exec_fspec->GetFilename().AsCString("<NULL>") : "<NULL>",
|
||||||
arch ? arch->GetArchitectureName() : "<NULL>", (const void *)uuid);
|
arch ? arch->GetArchitectureName() : "<NULL>", (const void *)uuid);
|
||||||
|
|
||||||
|
|
|
@ -72,7 +72,8 @@ void SystemInitializerCommon::Initialize() {
|
||||||
llvm::EnablePrettyStackTrace();
|
llvm::EnablePrettyStackTrace();
|
||||||
InitializeLog();
|
InitializeLog();
|
||||||
HostInfo::Initialize();
|
HostInfo::Initialize();
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
process_gdb_remote::ProcessGDBRemoteLog::Initialize();
|
process_gdb_remote::ProcessGDBRemoteLog::Initialize();
|
||||||
|
|
||||||
|
@ -102,7 +103,8 @@ void SystemInitializerCommon::Initialize() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void SystemInitializerCommon::Terminate() {
|
void SystemInitializerCommon::Terminate() {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
ObjectContainerBSDArchive::Terminate();
|
ObjectContainerBSDArchive::Terminate();
|
||||||
ObjectFileELF::Terminate();
|
ObjectFileELF::Terminate();
|
||||||
ObjectFilePECOFF::Terminate();
|
ObjectFilePECOFF::Terminate();
|
||||||
|
|
|
@ -169,7 +169,8 @@ bool CommandInterpreter::GetSpaceReplPrompts() const {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandInterpreter::Initialize() {
|
void CommandInterpreter::Initialize() {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
CommandReturnObject result;
|
CommandReturnObject result;
|
||||||
|
|
||||||
|
@ -391,7 +392,8 @@ const char *CommandInterpreter::ProcessEmbeddedScriptCommands(const char *arg) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void CommandInterpreter::LoadCommandDictionary() {
|
void CommandInterpreter::LoadCommandDictionary() {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
lldb::ScriptLanguage script_language = m_debugger.GetScriptLanguage();
|
lldb::ScriptLanguage script_language = m_debugger.GetScriptLanguage();
|
||||||
|
|
||||||
|
@ -1533,8 +1535,8 @@ bool CommandInterpreter::HandleCommand(const char *command_line,
|
||||||
if (log)
|
if (log)
|
||||||
log->Printf("Processing command: %s", command_line);
|
log->Printf("Processing command: %s", command_line);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "Handling command: %s.",
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
command_line);
|
Timer scoped_timer(func_cat, "Handling command: %s.", command_line);
|
||||||
|
|
||||||
if (!no_context_switching)
|
if (!no_context_switching)
|
||||||
UpdateExecutionContext(override_context);
|
UpdateExecutionContext(override_context);
|
||||||
|
|
|
@ -1803,7 +1803,8 @@ lldb::addr_t AppleObjCRuntimeV2::GetSharedCacheReadOnlyAddress() {
|
||||||
void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
|
void AppleObjCRuntimeV2::UpdateISAToDescriptorMapIfNeeded() {
|
||||||
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
|
Log *log(GetLogIfAnyCategoriesSet(LIBLLDB_LOG_PROCESS | LIBLLDB_LOG_TYPES));
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
// Else we need to check with our process to see when the map was updated.
|
// Else we need to check with our process to see when the map was updated.
|
||||||
Process *process = GetProcess();
|
Process *process = GetProcess();
|
||||||
|
|
|
@ -301,8 +301,9 @@ ObjectContainer *ObjectContainerBSDArchive::CreateInstance(
|
||||||
DataExtractor data;
|
DataExtractor data;
|
||||||
data.SetData(data_sp, data_offset, length);
|
data.SetData(data_sp, data_offset, length);
|
||||||
if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) {
|
if (file && data_sp && ObjectContainerBSDArchive::MagicBytesMatch(data)) {
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat,
|
||||||
"ObjectContainerBSDArchive::CreateInstance (module = %s, file = "
|
"ObjectContainerBSDArchive::CreateInstance (module = %s, file = "
|
||||||
"%p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
|
"%p, file_offset = 0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
|
||||||
module_sp->GetFileSpec().GetPath().c_str(),
|
module_sp->GetFileSpec().GetPath().c_str(),
|
||||||
|
|
|
@ -727,8 +727,9 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
||||||
uint32_t core_notes_crc = 0;
|
uint32_t core_notes_crc = 0;
|
||||||
|
|
||||||
if (!gnu_debuglink_crc) {
|
if (!gnu_debuglink_crc) {
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
lldb_private::Timer scoped_timer(
|
lldb_private::Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat,
|
||||||
"Calculating module crc32 %s with size %" PRIu64 " KiB",
|
"Calculating module crc32 %s with size %" PRIu64 " KiB",
|
||||||
file.GetLastPathComponent().AsCString(),
|
file.GetLastPathComponent().AsCString(),
|
||||||
(file.GetByteSize() - file_offset) / 1024);
|
(file.GetByteSize() - file_offset) / 1024);
|
||||||
|
|
|
@ -2121,8 +2121,8 @@ UUID ObjectFileMachO::GetSharedCacheUUID(FileSpec dyld_shared_cache,
|
||||||
}
|
}
|
||||||
|
|
||||||
size_t ObjectFileMachO::ParseSymtab() {
|
size_t ObjectFileMachO::ParseSymtab() {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"ObjectFileMachO::ParseSymtab () module = %s",
|
Timer scoped_timer(func_cat, "ObjectFileMachO::ParseSymtab () module = %s",
|
||||||
m_file.GetFilename().AsCString(""));
|
m_file.GetFilename().AsCString(""));
|
||||||
ModuleSP module_sp(GetModule());
|
ModuleSP module_sp(GetModule());
|
||||||
if (!module_sp)
|
if (!module_sp)
|
||||||
|
|
|
@ -928,7 +928,8 @@ protected:
|
||||||
};
|
};
|
||||||
|
|
||||||
void ScriptInterpreterPython::ExecuteInterpreterLoop() {
|
void ScriptInterpreterPython::ExecuteInterpreterLoop() {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
Debugger &debugger = GetCommandInterpreter().GetDebugger();
|
Debugger &debugger = GetCommandInterpreter().GetDebugger();
|
||||||
|
|
||||||
|
@ -1995,7 +1996,8 @@ bool ScriptInterpreterPython::GetScriptedSummary(
|
||||||
StructuredData::ObjectSP &callee_wrapper_sp,
|
StructuredData::ObjectSP &callee_wrapper_sp,
|
||||||
const TypeSummaryOptions &options, std::string &retval) {
|
const TypeSummaryOptions &options, std::string &retval) {
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
if (!valobj.get()) {
|
if (!valobj.get()) {
|
||||||
retval.assign("<no object>");
|
retval.assign("<no object>");
|
||||||
|
@ -2019,8 +2021,8 @@ bool ScriptInterpreterPython::GetScriptedSummary(
|
||||||
{
|
{
|
||||||
TypeSummaryOptionsSP options_sp(new TypeSummaryOptions(options));
|
TypeSummaryOptionsSP options_sp(new TypeSummaryOptions(options));
|
||||||
|
|
||||||
Timer scoped_timer("g_swig_typescript_callback",
|
static Timer::Category func_cat("g_swig_typescript_callback");
|
||||||
"g_swig_typescript_callback");
|
Timer scoped_timer(func_cat, "g_swig_typescript_callback");
|
||||||
ret_val = g_swig_typescript_callback(
|
ret_val = g_swig_typescript_callback(
|
||||||
python_function_name, GetSessionDictionary().get(), valobj,
|
python_function_name, GetSessionDictionary().get(), valobj,
|
||||||
&new_callee, options_sp, retval);
|
&new_callee, options_sp, retval);
|
||||||
|
@ -3102,7 +3104,8 @@ void ScriptInterpreterPython::InitializePrivate() {
|
||||||
|
|
||||||
g_initialized = true;
|
g_initialized = true;
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
|
|
||||||
// RAII-based initialization which correctly handles multiple-initialization,
|
// RAII-based initialization which correctly handles multiple-initialization,
|
||||||
// version-
|
// version-
|
||||||
|
|
|
@ -135,8 +135,9 @@ size_t DWARFCompileUnit::ExtractDIEsIfNeeded(bool cu_die_only) {
|
||||||
if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 1)
|
if ((cu_die_only && initial_die_array_size > 0) || initial_die_array_size > 1)
|
||||||
return 0; // Already parsed
|
return 0; // Already parsed
|
||||||
|
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat,
|
||||||
"%8.8x: DWARFCompileUnit::ExtractDIEsIfNeeded( cu_die_only = %i )",
|
"%8.8x: DWARFCompileUnit::ExtractDIEsIfNeeded( cu_die_only = %i )",
|
||||||
m_offset, cu_die_only);
|
m_offset, cu_die_only);
|
||||||
|
|
||||||
|
|
|
@ -110,7 +110,8 @@ void DWARFDebugAranges::AppendRange(dw_offset_t offset, dw_addr_t low_pc,
|
||||||
}
|
}
|
||||||
|
|
||||||
void DWARFDebugAranges::Sort(bool minimize) {
|
void DWARFDebugAranges::Sort(bool minimize) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s this = %p", LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION,
|
||||||
static_cast<void *>(this));
|
static_cast<void *>(this));
|
||||||
|
|
||||||
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
|
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_ARANGES));
|
||||||
|
|
|
@ -484,9 +484,9 @@ bool DWARFDebugLine::ParseStatementTable(
|
||||||
|
|
||||||
const dw_offset_t debug_line_offset = *offset_ptr;
|
const dw_offset_t debug_line_offset = *offset_ptr;
|
||||||
|
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat, "DWARFDebugLine::ParseStatementTable (.debug_line[0x%8.8x])",
|
||||||
"DWARFDebugLine::ParseStatementTable (.debug_line[0x%8.8x])",
|
|
||||||
debug_line_offset);
|
debug_line_offset);
|
||||||
|
|
||||||
if (!ParsePrologue(debug_line_data, offset_ptr, prologue.get())) {
|
if (!ParsePrologue(debug_line_data, offset_ptr, prologue.get())) {
|
||||||
|
|
|
@ -25,7 +25,8 @@ using namespace lldb_private;
|
||||||
DWARFDebugPubnames::DWARFDebugPubnames() : m_sets() {}
|
DWARFDebugPubnames::DWARFDebugPubnames() : m_sets() {}
|
||||||
|
|
||||||
bool DWARFDebugPubnames::Extract(const DWARFDataExtractor &data) {
|
bool DWARFDebugPubnames::Extract(const DWARFDataExtractor &data) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"DWARFDebugPubnames::Extract (byte_size = %" PRIu64 ")",
|
"DWARFDebugPubnames::Extract (byte_size = %" PRIu64 ")",
|
||||||
(uint64_t)data.GetByteSize());
|
(uint64_t)data.GetByteSize());
|
||||||
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
|
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_DEBUG_PUBNAMES));
|
||||||
|
@ -52,7 +53,8 @@ bool DWARFDebugPubnames::Extract(const DWARFDataExtractor &data) {
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF *dwarf2Data) {
|
bool DWARFDebugPubnames::GeneratePubnames(SymbolFileDWARF *dwarf2Data) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"DWARFDebugPubnames::GeneratePubnames (data = %p)",
|
"DWARFDebugPubnames::GeneratePubnames (data = %p)",
|
||||||
static_cast<void *>(dwarf2Data));
|
static_cast<void *>(dwarf2Data));
|
||||||
|
|
||||||
|
|
|
@ -666,8 +666,9 @@ const DWARFDebugAbbrev *SymbolFileDWARF::DebugAbbrev() const {
|
||||||
|
|
||||||
DWARFDebugInfo *SymbolFileDWARF::DebugInfo() {
|
DWARFDebugInfo *SymbolFileDWARF::DebugInfo() {
|
||||||
if (m_info.get() == NULL) {
|
if (m_info.get() == NULL) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s this = %p",
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
LLVM_PRETTY_FUNCTION, static_cast<void *>(this));
|
Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION,
|
||||||
|
static_cast<void *>(this));
|
||||||
if (get_debug_info_data().GetByteSize() > 0) {
|
if (get_debug_info_data().GetByteSize() > 0) {
|
||||||
m_info.reset(new DWARFDebugInfo());
|
m_info.reset(new DWARFDebugInfo());
|
||||||
if (m_info.get()) {
|
if (m_info.get()) {
|
||||||
|
@ -703,8 +704,9 @@ SymbolFileDWARF::GetDWARFCompileUnit(lldb_private::CompileUnit *comp_unit) {
|
||||||
|
|
||||||
DWARFDebugRanges *SymbolFileDWARF::DebugRanges() {
|
DWARFDebugRanges *SymbolFileDWARF::DebugRanges() {
|
||||||
if (m_ranges.get() == NULL) {
|
if (m_ranges.get() == NULL) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s this = %p",
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
LLVM_PRETTY_FUNCTION, static_cast<void *>(this));
|
Timer scoped_timer(func_cat, "%s this = %p", LLVM_PRETTY_FUNCTION,
|
||||||
|
static_cast<void *>(this));
|
||||||
if (get_debug_ranges_data().GetByteSize() > 0) {
|
if (get_debug_ranges_data().GetByteSize() > 0) {
|
||||||
m_ranges.reset(new DWARFDebugRanges());
|
m_ranges.reset(new DWARFDebugRanges());
|
||||||
if (m_ranges.get())
|
if (m_ranges.get())
|
||||||
|
@ -1666,7 +1668,9 @@ SymbolFileDWARF::GlobalVariableMap &SymbolFileDWARF::GetGlobalAranges() {
|
||||||
uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr,
|
uint32_t SymbolFileDWARF::ResolveSymbolContext(const Address &so_addr,
|
||||||
uint32_t resolve_scope,
|
uint32_t resolve_scope,
|
||||||
SymbolContext &sc) {
|
SymbolContext &sc) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "SymbolFileDWARF::"
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
|
"SymbolFileDWARF::"
|
||||||
"ResolveSymbolContext (so_addr = { "
|
"ResolveSymbolContext (so_addr = { "
|
||||||
"section = %p, offset = 0x%" PRIx64
|
"section = %p, offset = 0x%" PRIx64
|
||||||
" }, resolve_scope = 0x%8.8x)",
|
" }, resolve_scope = 0x%8.8x)",
|
||||||
|
@ -1927,8 +1931,9 @@ void SymbolFileDWARF::Index() {
|
||||||
if (m_indexed)
|
if (m_indexed)
|
||||||
return;
|
return;
|
||||||
m_indexed = true;
|
m_indexed = true;
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION, "SymbolFileDWARF::Index (%s)",
|
func_cat, "SymbolFileDWARF::Index (%s)",
|
||||||
GetObjectFile()->GetFileSpec().GetFilename().AsCString("<Unknown>"));
|
GetObjectFile()->GetFileSpec().GetFilename().AsCString("<Unknown>"));
|
||||||
|
|
||||||
DWARFDebugInfo *debug_info = DebugInfo();
|
DWARFDebugInfo *debug_info = DebugInfo();
|
||||||
|
@ -2390,8 +2395,8 @@ SymbolFileDWARF::FindFunctions(const ConstString &name,
|
||||||
const CompilerDeclContext *parent_decl_ctx,
|
const CompilerDeclContext *parent_decl_ctx,
|
||||||
uint32_t name_type_mask, bool include_inlines,
|
uint32_t name_type_mask, bool include_inlines,
|
||||||
bool append, SymbolContextList &sc_list) {
|
bool append, SymbolContextList &sc_list) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"SymbolFileDWARF::FindFunctions (name = '%s')",
|
Timer scoped_timer(func_cat, "SymbolFileDWARF::FindFunctions (name = '%s')",
|
||||||
name.AsCString());
|
name.AsCString());
|
||||||
|
|
||||||
// eFunctionNameTypeAuto should be pre-resolved by a call to
|
// eFunctionNameTypeAuto should be pre-resolved by a call to
|
||||||
|
@ -2670,8 +2675,8 @@ SymbolFileDWARF::FindFunctions(const ConstString &name,
|
||||||
uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression ®ex,
|
uint32_t SymbolFileDWARF::FindFunctions(const RegularExpression ®ex,
|
||||||
bool include_inlines, bool append,
|
bool include_inlines, bool append,
|
||||||
SymbolContextList &sc_list) {
|
SymbolContextList &sc_list) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"SymbolFileDWARF::FindFunctions (regex = '%s')",
|
Timer scoped_timer(func_cat, "SymbolFileDWARF::FindFunctions (regex = '%s')",
|
||||||
regex.GetText().str().c_str());
|
regex.GetText().str().c_str());
|
||||||
|
|
||||||
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
|
Log *log(LogChannelDWARF::GetLogIfAll(DWARF_LOG_LOOKUPS));
|
||||||
|
|
|
@ -991,7 +991,8 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(
|
||||||
const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
|
const ConstString &name, const CompilerDeclContext *parent_decl_ctx,
|
||||||
uint32_t name_type_mask, bool include_inlines, bool append,
|
uint32_t name_type_mask, bool include_inlines, bool append,
|
||||||
SymbolContextList &sc_list) {
|
SymbolContextList &sc_list) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"SymbolFileDWARFDebugMap::FindFunctions (name = %s)",
|
"SymbolFileDWARFDebugMap::FindFunctions (name = %s)",
|
||||||
name.GetCString());
|
name.GetCString());
|
||||||
|
|
||||||
|
@ -1018,7 +1019,8 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression ®ex,
|
||||||
bool include_inlines,
|
bool include_inlines,
|
||||||
bool append,
|
bool append,
|
||||||
SymbolContextList &sc_list) {
|
SymbolContextList &sc_list) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')",
|
"SymbolFileDWARFDebugMap::FindFunctions (regex = '%s')",
|
||||||
regex.GetText().str().c_str());
|
regex.GetText().str().c_str());
|
||||||
|
|
||||||
|
@ -1044,7 +1046,8 @@ uint32_t SymbolFileDWARFDebugMap::FindFunctions(const RegularExpression ®ex,
|
||||||
size_t SymbolFileDWARFDebugMap::GetTypes(SymbolContextScope *sc_scope,
|
size_t SymbolFileDWARFDebugMap::GetTypes(SymbolContextScope *sc_scope,
|
||||||
uint32_t type_mask,
|
uint32_t type_mask,
|
||||||
TypeList &type_list) {
|
TypeList &type_list) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"SymbolFileDWARFDebugMap::GetTypes (type_mask = 0x%8.8x)",
|
"SymbolFileDWARFDebugMap::GetTypes (type_mask = 0x%8.8x)",
|
||||||
type_mask);
|
type_mask);
|
||||||
|
|
||||||
|
|
|
@ -92,8 +92,8 @@ SymbolVendorELF::CreateInstance(const lldb::ModuleSP &module_sp,
|
||||||
if (file_spec_list.IsEmpty())
|
if (file_spec_list.IsEmpty())
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"SymbolVendorELF::CreateInstance (module = %s)",
|
Timer scoped_timer(func_cat, "SymbolVendorELF::CreateInstance (module = %s)",
|
||||||
module_sp->GetFileSpec().GetPath().c_str());
|
module_sp->GetFileSpec().GetPath().c_str());
|
||||||
|
|
||||||
for (size_t idx = 0; idx < file_spec_list.GetSize(); ++idx) {
|
for (size_t idx = 0; idx < file_spec_list.GetSize(); ++idx) {
|
||||||
|
|
|
@ -419,7 +419,8 @@ void DWARFCallFrameInfo::GetFDEIndex() {
|
||||||
if (m_fde_index_initialized) // if two threads hit the locker
|
if (m_fde_index_initialized) // if two threads hit the locker
|
||||||
return;
|
return;
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s - %s", LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s - %s", LLVM_PRETTY_FUNCTION,
|
||||||
m_objfile.GetFileSpec().GetFilename().AsCString(""));
|
m_objfile.GetFileSpec().GetFilename().AsCString(""));
|
||||||
|
|
||||||
bool clear_address_zeroth_bit = false;
|
bool clear_address_zeroth_bit = false;
|
||||||
|
|
|
@ -37,8 +37,9 @@ ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp, const FileSpec *file,
|
||||||
ObjectFileSP object_file_sp;
|
ObjectFileSP object_file_sp;
|
||||||
|
|
||||||
if (module_sp) {
|
if (module_sp) {
|
||||||
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
Timer scoped_timer(
|
Timer scoped_timer(
|
||||||
LLVM_PRETTY_FUNCTION,
|
func_cat,
|
||||||
"ObjectFile::FindPlugin (module = %s, file = %p, file_offset = "
|
"ObjectFile::FindPlugin (module = %s, file = %p, file_offset = "
|
||||||
"0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
|
"0x%8.8" PRIx64 ", file_size = 0x%8.8" PRIx64 ")",
|
||||||
module_sp->GetFileSpec().GetPath().c_str(),
|
module_sp->GetFileSpec().GetPath().c_str(),
|
||||||
|
@ -176,7 +177,9 @@ ObjectFileSP ObjectFile::FindPlugin(const lldb::ModuleSP &module_sp,
|
||||||
ObjectFileSP object_file_sp;
|
ObjectFileSP object_file_sp;
|
||||||
|
|
||||||
if (module_sp) {
|
if (module_sp) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "ObjectFile::FindPlugin (module = "
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
|
"ObjectFile::FindPlugin (module = "
|
||||||
"%s, process = %p, header_addr = "
|
"%s, process = %p, header_addr = "
|
||||||
"0x%" PRIx64 ")",
|
"0x%" PRIx64 ")",
|
||||||
module_sp->GetFileSpec().GetPath().c_str(),
|
module_sp->GetFileSpec().GetPath().c_str(),
|
||||||
|
|
|
@ -220,7 +220,8 @@ void Symtab::InitNameIndexes() {
|
||||||
// Protected function, no need to lock mutex...
|
// Protected function, no need to lock mutex...
|
||||||
if (!m_name_indexes_computed) {
|
if (!m_name_indexes_computed) {
|
||||||
m_name_indexes_computed = true;
|
m_name_indexes_computed = true;
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
// Create the name index vector to be able to quickly search by name
|
// Create the name index vector to be able to quickly search by name
|
||||||
const size_t num_symbols = m_symbols.size();
|
const size_t num_symbols = m_symbols.size();
|
||||||
#if 1
|
#if 1
|
||||||
|
@ -433,7 +434,8 @@ void Symtab::AppendSymbolNamesToMap(const IndexCollection &indexes,
|
||||||
bool add_demangled, bool add_mangled,
|
bool add_demangled, bool add_mangled,
|
||||||
NameToIndexMap &name_to_index_map) const {
|
NameToIndexMap &name_to_index_map) const {
|
||||||
if (add_demangled || add_mangled) {
|
if (add_demangled || add_mangled) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
// Create the name index vector to be able to quickly search by name
|
// Create the name index vector to be able to quickly search by name
|
||||||
|
@ -595,7 +597,8 @@ void Symtab::SortSymbolIndexesByValue(std::vector<uint32_t> &indexes,
|
||||||
bool remove_duplicates) const {
|
bool remove_duplicates) const {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, LLVM_PRETTY_FUNCTION);
|
||||||
// No need to sort if we have zero or one items...
|
// No need to sort if we have zero or one items...
|
||||||
if (indexes.size() <= 1)
|
if (indexes.size() <= 1)
|
||||||
return;
|
return;
|
||||||
|
@ -621,7 +624,8 @@ uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name,
|
||||||
std::vector<uint32_t> &indexes) {
|
std::vector<uint32_t> &indexes) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
if (symbol_name) {
|
if (symbol_name) {
|
||||||
if (!m_name_indexes_computed)
|
if (!m_name_indexes_computed)
|
||||||
InitNameIndexes();
|
InitNameIndexes();
|
||||||
|
@ -637,7 +641,8 @@ uint32_t Symtab::AppendSymbolIndexesWithName(const ConstString &symbol_name,
|
||||||
std::vector<uint32_t> &indexes) {
|
std::vector<uint32_t> &indexes) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
if (symbol_name) {
|
if (symbol_name) {
|
||||||
const size_t old_size = indexes.size();
|
const size_t old_size = indexes.size();
|
||||||
if (!m_name_indexes_computed)
|
if (!m_name_indexes_computed)
|
||||||
|
@ -766,7 +771,8 @@ Symtab::FindAllSymbolsWithNameAndType(const ConstString &name,
|
||||||
std::vector<uint32_t> &symbol_indexes) {
|
std::vector<uint32_t> &symbol_indexes) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
// Initialize all of the lookup by name indexes before converting NAME
|
// Initialize all of the lookup by name indexes before converting NAME
|
||||||
// to a uniqued string NAME_STR below.
|
// to a uniqued string NAME_STR below.
|
||||||
if (!m_name_indexes_computed)
|
if (!m_name_indexes_computed)
|
||||||
|
@ -785,7 +791,8 @@ size_t Symtab::FindAllSymbolsWithNameAndType(
|
||||||
Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
|
Visibility symbol_visibility, std::vector<uint32_t> &symbol_indexes) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
// Initialize all of the lookup by name indexes before converting NAME
|
// Initialize all of the lookup by name indexes before converting NAME
|
||||||
// to a uniqued string NAME_STR below.
|
// to a uniqued string NAME_STR below.
|
||||||
if (!m_name_indexes_computed)
|
if (!m_name_indexes_computed)
|
||||||
|
@ -817,7 +824,8 @@ Symbol *Symtab::FindFirstSymbolWithNameAndType(const ConstString &name,
|
||||||
Visibility symbol_visibility) {
|
Visibility symbol_visibility) {
|
||||||
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
std::lock_guard<std::recursive_mutex> guard(m_mutex);
|
||||||
|
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION, "%s", LLVM_PRETTY_FUNCTION);
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat, "%s", LLVM_PRETTY_FUNCTION);
|
||||||
if (!m_name_indexes_computed)
|
if (!m_name_indexes_computed)
|
||||||
InitNameIndexes();
|
InitNameIndexes();
|
||||||
|
|
||||||
|
|
|
@ -1235,7 +1235,8 @@ void Target::SetExecutableModule(ModuleSP &executable_sp,
|
||||||
ClearModules(false);
|
ClearModules(false);
|
||||||
|
|
||||||
if (executable_sp) {
|
if (executable_sp) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
|
Timer scoped_timer(func_cat,
|
||||||
"Target::SetExecutableModule (executable = '%s')",
|
"Target::SetExecutableModule (executable = '%s')",
|
||||||
executable_sp->GetFileSpec().GetPath().c_str());
|
executable_sp->GetFileSpec().GetPath().c_str());
|
||||||
|
|
||||||
|
|
|
@ -325,10 +325,10 @@ Status TargetList::CreateTargetInternal(Debugger &debugger,
|
||||||
lldb::PlatformSP &platform_sp,
|
lldb::PlatformSP &platform_sp,
|
||||||
lldb::TargetSP &target_sp,
|
lldb::TargetSP &target_sp,
|
||||||
bool is_dummy_target) {
|
bool is_dummy_target) {
|
||||||
Timer scoped_timer(LLVM_PRETTY_FUNCTION,
|
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||||
"TargetList::CreateTarget (file = '%s', arch = '%s')",
|
Timer scoped_timer(
|
||||||
user_exe_path.str().c_str(),
|
func_cat, "TargetList::CreateTarget (file = '%s', arch = '%s')",
|
||||||
specified_arch.GetArchitectureName());
|
user_exe_path.str().c_str(), specified_arch.GetArchitectureName());
|
||||||
Status error;
|
Status error;
|
||||||
|
|
||||||
ArchSpec arch(specified_arch);
|
ArchSpec arch(specified_arch);
|
||||||
|
|
|
@ -18,7 +18,8 @@ using namespace lldb_private;
|
||||||
TEST(TimerTest, CategoryTimes) {
|
TEST(TimerTest, CategoryTimes) {
|
||||||
Timer::ResetCategoryTimes();
|
Timer::ResetCategoryTimes();
|
||||||
{
|
{
|
||||||
Timer t("CAT1", "");
|
static Timer::Category tcat("CAT1");
|
||||||
|
Timer t(tcat, "");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
StreamString ss;
|
StreamString ss;
|
||||||
|
@ -32,14 +33,18 @@ TEST(TimerTest, CategoryTimes) {
|
||||||
TEST(TimerTest, CategoryTimesNested) {
|
TEST(TimerTest, CategoryTimesNested) {
|
||||||
Timer::ResetCategoryTimes();
|
Timer::ResetCategoryTimes();
|
||||||
{
|
{
|
||||||
Timer t1("CAT1", "");
|
static Timer::Category tcat1("CAT1");
|
||||||
|
Timer t1(tcat1, "");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
Timer t2("CAT1", "");
|
// Explicitly testing the same category as above.
|
||||||
|
Timer t2(tcat1, "");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
StreamString ss;
|
StreamString ss;
|
||||||
Timer::DumpCategoryTimes(&ss);
|
Timer::DumpCategoryTimes(&ss);
|
||||||
double seconds;
|
double seconds;
|
||||||
|
// It should only appear once.
|
||||||
|
ASSERT_EQ(ss.GetString().count("CAT1"), 1U);
|
||||||
ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
|
ASSERT_EQ(1, sscanf(ss.GetData(), "%lf sec for CAT1", &seconds));
|
||||||
EXPECT_LT(0.002, seconds);
|
EXPECT_LT(0.002, seconds);
|
||||||
EXPECT_GT(0.2, seconds);
|
EXPECT_GT(0.2, seconds);
|
||||||
|
@ -48,9 +53,11 @@ TEST(TimerTest, CategoryTimesNested) {
|
||||||
TEST(TimerTest, CategoryTimes2) {
|
TEST(TimerTest, CategoryTimes2) {
|
||||||
Timer::ResetCategoryTimes();
|
Timer::ResetCategoryTimes();
|
||||||
{
|
{
|
||||||
Timer t1("CAT1", "");
|
static Timer::Category tcat1("CAT1");
|
||||||
|
Timer t1(tcat1, "");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
std::this_thread::sleep_for(std::chrono::milliseconds(100));
|
||||||
Timer t2("CAT2", "");
|
static Timer::Category tcat2("CAT2");
|
||||||
|
Timer t2(tcat2, "");
|
||||||
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
std::this_thread::sleep_for(std::chrono::milliseconds(10));
|
||||||
}
|
}
|
||||||
StreamString ss;
|
StreamString ss;
|
||||||
|
|
Loading…
Reference in New Issue