summaryrefslogtreecommitdiffstats
path: root/lldb/source/Core/Disassembler.cpp
diff options
context:
space:
mode:
authorPavel Labath <labath@google.com>2017-05-15 13:02:37 +0000
committerPavel Labath <labath@google.com>2017-05-15 13:02:37 +0000
commitf9d16476573e16856bdb3250c817b0a2c631d2b1 (patch)
tree7cae9a3d7fb178078ab0e4990ebf991c93679c08 /lldb/source/Core/Disassembler.cpp
parent3030bf0c816b136c97d8c69ca8b38e394eefd5d2 (diff)
downloadbcm5719-llvm-f9d16476573e16856bdb3250c817b0a2c631d2b1.tar.gz
bcm5719-llvm-f9d16476573e16856bdb3250c817b0a2c631d2b1.zip
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
Diffstat (limited to 'lldb/source/Core/Disassembler.cpp')
-rw-r--r--lldb/source/Core/Disassembler.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/lldb/source/Core/Disassembler.cpp b/lldb/source/Core/Disassembler.cpp
index eb79022c43a..0a5d763b6d3 100644
--- a/lldb/source/Core/Disassembler.cpp
+++ b/lldb/source/Core/Disassembler.cpp
@@ -59,7 +59,8 @@ using namespace lldb_private;
DisassemblerSP Disassembler::FindPlugin(const ArchSpec &arch,
const char *flavor,
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)",
arch.GetArchitectureName(), plugin_name);
@@ -1460,4 +1461,3 @@ std::function<bool(const Instruction::Operand &)>
lldb_private::OperandMatchers::MatchOpType(Instruction::Operand::Type type) {
return [type](const Instruction::Operand &op) { return op.m_type == type; };
}
-
OpenPOWER on IntegriCloud