[Lldb-commits] [lldb] r203420 - SBQueue::GetNumPendingItems() should not force a fetch of the pending
Jason Molenda
jmolenda at apple.com
Sun Mar 9 12:41:31 PDT 2014
Author: jmolenda
Date: Sun Mar 9 14:41:30 2014
New Revision: 203420
URL: http://llvm.org/viewvc/llvm-project?rev=203420&view=rev
Log:
SBQueue::GetNumPendingItems() should not force a fetch of the pending
items; the backing Queue object has the number of pending items
already cached. Also, add SBQueue::GetNumRunningItems() to provide
that information.
<rdar://problem/16272016>
Modified:
lldb/trunk/include/lldb/API/SBQueue.h
lldb/trunk/source/API/SBQueue.cpp
Modified: lldb/trunk/include/lldb/API/SBQueue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBQueue.h?rev=203420&r1=203419&r2=203420&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBQueue.h (original)
+++ lldb/trunk/include/lldb/API/SBQueue.h Sun Mar 9 14:41:30 2014
@@ -62,6 +62,9 @@ public:
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t);
+ uint32_t
+ GetNumRunningItems ();
+
protected:
friend class SBProcess;
Modified: lldb/trunk/source/API/SBQueue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBQueue.cpp?rev=203420&r1=203419&r2=203420&view=diff
==============================================================================
--- lldb/trunk/source/API/SBQueue.cpp (original)
+++ lldb/trunk/source/API/SBQueue.cpp Sun Mar 9 14:41:30 2014
@@ -222,21 +222,24 @@ namespace lldb_private
}
return sb_thread;
}
-
-
+
uint32_t
GetNumPendingItems ()
{
uint32_t result = 0;
- FetchItems();
-
- if (m_pending_items_fetched)
+
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (m_pending_items_fetched == false && queue_sp)
+ {
+ result = queue_sp->GetNumPendingWorkItems();
+ }
+ else
{
result = m_pending_items.size();
}
return result;
}
-
+
lldb::SBQueueItem
GetPendingItemAtIndex (uint32_t idx)
{
@@ -248,6 +251,16 @@ namespace lldb_private
}
return result;
}
+
+ uint32_t
+ GetNumRunningItems ()
+ {
+ uint32_t result = 0;
+ QueueSP queue_sp = m_queue_wp.lock();
+ if (queue_sp)
+ result = queue_sp->GetNumRunningWorkItems();
+ return result;
+ }
lldb::SBProcess
GetProcess ()
@@ -399,6 +412,16 @@ SBQueue::GetPendingItemAtIndex (uint32_t
return m_opaque_sp->GetPendingItemAtIndex (idx);
}
+uint32_t
+SBQueue::GetNumRunningItems ()
+{
+ uint32_t running_items = m_opaque_sp->GetNumRunningItems ();
+ Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
+ if (log)
+ log->Printf("SBQueue(0x%" PRIx64 ")::GetNumRunningItems() == %d", m_opaque_sp->GetQueueID(), running_items);
+ return running_items;
+}
+
SBProcess
SBQueue::GetProcess ()
{
More information about the lldb-commits
mailing list