[Lldb-commits] [lldb] 9173fd7 - [lldb] Avoid repeated map lookups (NFC) (#112655)

via lldb-commits lldb-commits at lists.llvm.org
Thu Oct 17 07:45:53 PDT 2024


Author: Kazu Hirata
Date: 2024-10-17T07:45:50-07:00
New Revision: 9173fd77394aa9617b235e1b146114f76c6d77d6

URL: https://github.com/llvm/llvm-project/commit/9173fd77394aa9617b235e1b146114f76c6d77d6
DIFF: https://github.com/llvm/llvm-project/commit/9173fd77394aa9617b235e1b146114f76c6d77d6.diff

LOG: [lldb] Avoid repeated map lookups (NFC) (#112655)

Added: 
    

Modified: 
    lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp

Removed: 
    


################################################################################
diff  --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3e09c316d74f44..538c8680140091 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -5323,9 +5323,8 @@ std::string ProcessGDBRemote::HarmonizeThreadIdsForProfileData(
         uint32_t prev_used_usec = 0;
         std::map<uint64_t, uint32_t>::iterator iterator =
             m_thread_id_to_used_usec_map.find(thread_id);
-        if (iterator != m_thread_id_to_used_usec_map.end()) {
-          prev_used_usec = m_thread_id_to_used_usec_map[thread_id];
-        }
+        if (iterator != m_thread_id_to_used_usec_map.end())
+          prev_used_usec = iterator->second;
 
         uint32_t real_used_usec = curr_used_usec - prev_used_usec;
         // A good first time record is one that runs for at least 0.25 sec


        


More information about the lldb-commits mailing list