diff --git a/src/hotspot/share/gc/shared/taskqueue.hpp b/src/hotspot/share/gc/shared/taskqueue.hpp index 7b9f47a65d1..0c1f9beec43 100644 --- a/src/hotspot/share/gc/shared/taskqueue.hpp +++ b/src/hotspot/share/gc/shared/taskqueue.hpp @@ -370,6 +370,8 @@ class TaskQueueSetSuper { public: // Returns "true" if some TaskQueue in the set contains a task. virtual bool peek() = 0; + // Tasks in queue + virtual uint tasks() const = 0; }; template class TaskQueueSetSuperImpl: public CHeapObj, public TaskQueueSetSuper { @@ -399,6 +401,7 @@ public: bool steal(uint queue_num, E& t); bool peek(); + uint tasks() const; uint size() const { return _n; } }; @@ -424,6 +427,15 @@ bool GenericTaskQueueSet::peek() { return false; } +template +uint GenericTaskQueueSet::tasks() const { + uint n = 0; + for (uint j = 0; j < _n; j++) { + n += _queues[j]->size(); + } + return n; +} + // When to terminate from the termination protocol. class TerminatorTerminator: public CHeapObj { public: