summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/ScriptInterpreter/Python
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/Plugins/ScriptInterpreter/Python
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/Plugins/ScriptInterpreter/Python')
-rw-r--r--lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp13
1 files changed, 8 insertions, 5 deletions
diff --git a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
index 985a7978c6a..d6d695fc2e7 100644
--- a/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
+++ b/lldb/source/Plugins/ScriptInterpreter/Python/ScriptInterpreterPython.cpp
@@ -928,7 +928,8 @@ protected:
};
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();
@@ -1995,7 +1996,8 @@ bool ScriptInterpreterPython::GetScriptedSummary(
StructuredData::ObjectSP &callee_wrapper_sp,
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()) {
retval.assign("<no object>");
@@ -2019,8 +2021,8 @@ bool ScriptInterpreterPython::GetScriptedSummary(
{
TypeSummaryOptionsSP options_sp(new TypeSummaryOptions(options));
- Timer scoped_timer("g_swig_typescript_callback",
- "g_swig_typescript_callback");
+ static Timer::Category func_cat("g_swig_typescript_callback");
+ Timer scoped_timer(func_cat, "g_swig_typescript_callback");
ret_val = g_swig_typescript_callback(
python_function_name, GetSessionDictionary().get(), valobj,
&new_callee, options_sp, retval);
@@ -3102,7 +3104,8 @@ void ScriptInterpreterPython::InitializePrivate() {
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,
// version-
OpenPOWER on IntegriCloud