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:
@@ -727,8 +727,9 @@ size_t ObjectFileELF::GetModuleSpecifications(
|
||||
uint32_t core_notes_crc = 0;
|
||||
|
||||
if (!gnu_debuglink_crc) {
|
||||
static Timer::Category func_cat(LLVM_PRETTY_FUNCTION);
|
||||
lldb_private::Timer scoped_timer(
|
||||
LLVM_PRETTY_FUNCTION,
|
||||
func_cat,
|
||||
"Calculating module crc32 %s with size %" PRIu64 " KiB",
|
||||
file.GetLastPathComponent().AsCString(),
|
||||
(file.GetByteSize() - file_offset) / 1024);
|
||||
|
||||
Reference in New Issue
Block a user