< prev index next >

src/hotspot/share/gc/shared/workerDataArray.hpp

Print this page
rev 57242 : imported patch 8235341-workerdataarray-cleanup
rev 57243 : [mq]: 8235341-stefanj-review


  28 #include "memory/allocation.hpp"
  29 #include "utilities/debug.hpp"
  30 
  31 class outputStream;
  32 
  33 template <class T>
  34 class WorkerDataArray  : public CHeapObj<mtGC> {
  35   friend class WDAPrinter;
  36 public:
  37   static const uint MaxThreadWorkItems = 6;
  38 private:
  39   T*          _data;
  40   uint        _length;
  41   const char* _title;
  42 
  43   bool _is_serial;
  44 
  45   WorkerDataArray<size_t>* _thread_work_items[MaxThreadWorkItems];
  46 
  47  public:
  48   WorkerDataArray(uint length, const char* title, bool is_serial = false);
  49   ~WorkerDataArray();
  50 
  51   void link_thread_work_items(WorkerDataArray<size_t>* thread_work_items, uint index = 0);




  52   void set_thread_work_item(uint worker_i, size_t value, uint index = 0);
  53   void add_thread_work_item(uint worker_i, size_t value, uint index = 0);
  54   void set_or_add_thread_work_item(uint worker_i, size_t value, uint index = 0);
  55   size_t get_thread_work_item(uint worker_i, uint index = 0);
  56 
  57   WorkerDataArray<size_t>* thread_work_items(uint index = 0) const {
  58     assert(index < MaxThreadWorkItems, "Tried to access thread work item %u max %u", index, MaxThreadWorkItems);
  59     return _thread_work_items[index];
  60   }
  61 
  62   static T uninitialized();
  63 
  64   void set(uint worker_i, T value);
  65   T get(uint worker_i) const;
  66 
  67   void add(uint worker_i, T value);
  68 
  69   // The sum() and average() methods below consider uninitialized slots to be 0.
  70   double average() const;
  71   T sum() const;




  28 #include "memory/allocation.hpp"
  29 #include "utilities/debug.hpp"
  30 
  31 class outputStream;
  32 
  33 template <class T>
  34 class WorkerDataArray  : public CHeapObj<mtGC> {
  35   friend class WDAPrinter;
  36 public:
  37   static const uint MaxThreadWorkItems = 6;
  38 private:
  39   T*          _data;
  40   uint        _length;
  41   const char* _title;
  42 
  43   bool _is_serial;
  44 
  45   WorkerDataArray<size_t>* _thread_work_items[MaxThreadWorkItems];
  46 
  47  public:
  48   WorkerDataArray(const char* title, uint length, bool is_serial = false);
  49   ~WorkerDataArray();
  50 
  51   // Create an integer sub-item at the given index to this WorkerDataArray. If length_override
  52   // is zero, use the same number of elements as this array, otherwise use the given
  53   // number.
  54   void create_thread_work_items(const char* title, uint index = 0, uint length_override = 0);
  55 
  56   void set_thread_work_item(uint worker_i, size_t value, uint index = 0);
  57   void add_thread_work_item(uint worker_i, size_t value, uint index = 0);
  58   void set_or_add_thread_work_item(uint worker_i, size_t value, uint index = 0);
  59   size_t get_thread_work_item(uint worker_i, uint index = 0);
  60 
  61   WorkerDataArray<size_t>* thread_work_items(uint index = 0) const {
  62     assert(index < MaxThreadWorkItems, "Tried to access thread work item %u max %u", index, MaxThreadWorkItems);
  63     return _thread_work_items[index];
  64   }
  65 
  66   static T uninitialized();
  67 
  68   void set(uint worker_i, T value);
  69   T get(uint worker_i) const;
  70 
  71   void add(uint worker_i, T value);
  72 
  73   // The sum() and average() methods below consider uninitialized slots to be 0.
  74   double average() const;
  75   T sum() const;


< prev index next >