src/hotspot/share/gc/shared/taskqueue.hpp
changeset 52122 cb20bf10cfbd
parent 51292 0538a5cdb474
child 52905 bec57b4a6d69
--- a/src/hotspot/share/gc/shared/taskqueue.hpp	Mon Oct 15 22:47:03 2018 +0800
+++ b/src/hotspot/share/gc/shared/taskqueue.hpp	Mon Oct 15 11:53:15 2018 -0400
@@ -370,6 +370,8 @@
 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 <MEMFLAGS F> class TaskQueueSetSuperImpl: public CHeapObj<F>, public TaskQueueSetSuper {
@@ -399,6 +401,7 @@
   bool steal(uint queue_num, E& t);
 
   bool peek();
+  uint tasks() const;
 
   uint size() const { return _n; }
 };
@@ -424,6 +427,15 @@
   return false;
 }
 
+template<class T, MEMFLAGS F>
+uint GenericTaskQueueSet<T, F>::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<mtInternal> {
 public: