[Lldb-commits] [lldb] [lldb] Avoid repeated map lookups (NFC) (PR #112655)
Kazu Hirata via lldb-commits
lldb-commits at lists.llvm.org
Wed Oct 16 23:43:43 PDT 2024
https://github.com/kazutakahirata updated https://github.com/llvm/llvm-project/pull/112655
>From 826b8ad10ef9d24e744aa00298ca380bfcd4c79a Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 16 Oct 2024 06:49:47 -0700
Subject: [PATCH 1/2] [lldb] Avoid repeated map lookups (NFC)
---
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 3e09c316d74f44..70cbd1c57b895a 100644
--- a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
+++ b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
@@ -5324,7 +5324,7 @@ std::string ProcessGDBRemote::HarmonizeThreadIdsForProfileData(
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];
+ prev_used_usec = iterator->second;
}
uint32_t real_used_usec = curr_used_usec - prev_used_usec;
>From a9fb4382e8f8936dfa861dc2dbd773c70a3981f5 Mon Sep 17 00:00:00 2001
From: Kazu Hirata <kazu at google.com>
Date: Wed, 16 Oct 2024 23:42:50 -0700
Subject: [PATCH 2/2] Remove curly braces.
---
lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp b/lldb/source/Plugins/Process/gdb-remote/ProcessGDBRemote.cpp
index 70cbd1c57b895a..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()) {
+ 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