diff options
author | Pavel Labath <labath@google.com> | 2017-05-15 13:02:37 +0000 |
---|---|---|
committer | Pavel Labath <labath@google.com> | 2017-05-15 13:02:37 +0000 |
commit | f9d16476573e16856bdb3250c817b0a2c631d2b1 (patch) | |
tree | 7cae9a3d7fb178078ab0e4990ebf991c93679c08 /lldb/source/Initialization/SystemInitializerCommon.cpp | |
parent | 3030bf0c816b136c97d8c69ca8b38e394eefd5d2 (diff) | |
download | bcm5719-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/Initialization/SystemInitializerCommon.cpp')
-rw-r--r-- | lldb/source/Initialization/SystemInitializerCommon.cpp | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/lldb/source/Initialization/SystemInitializerCommon.cpp b/lldb/source/Initialization/SystemInitializerCommon.cpp index 805e6091e68..77869807c79 100644 --- a/lldb/source/Initialization/SystemInitializerCommon.cpp +++ b/lldb/source/Initialization/SystemInitializerCommon.cpp @@ -72,7 +72,8 @@ void SystemInitializerCommon::Initialize() { llvm::EnablePrettyStackTrace(); InitializeLog(); 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(); @@ -102,7 +103,8 @@ void SystemInitializerCommon::Initialize() { } 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(); ObjectFileELF::Terminate(); ObjectFilePECOFF::Terminate(); |