< prev index next >

src/share/vm/gc/g1/workerDataArray.inline.hpp

Print this page
rev 13028 : imported patch 8178148-more-detailed-scan-rs-logging
rev 13029 : imported patch 8178148-sangheon-review
rev 13030 : imported patch 8178148-workerdata-add


  57 
  58 template <typename T>
  59 WorkerDataArray<T>::~WorkerDataArray() {
  60   FREE_C_HEAP_ARRAY(T, _data);
  61 }
  62 
  63 template <typename T>
  64 void WorkerDataArray<T>::link_thread_work_items(WorkerDataArray<size_t>* thread_work_items, uint index) {
  65   assert(index < MaxThreadWorkItems, "Tried to access thread work item %u (max %u)", index, MaxThreadWorkItems);
  66   _thread_work_items[index] = thread_work_items;
  67 }
  68 
  69 template <typename T>
  70 void WorkerDataArray<T>::set_thread_work_item(uint worker_i, size_t value, uint index) {
  71   assert(index < MaxThreadWorkItems, "Tried to access thread work item %u (max %u)", index, MaxThreadWorkItems);
  72   assert(_thread_work_items[index] != NULL, "No sub count");
  73   _thread_work_items[index]->set(worker_i, value);
  74 }
  75 
  76 template <typename T>







  77 void WorkerDataArray<T>::add(uint worker_i, T value) {
  78   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  79   assert(_data[worker_i] != uninitialized(), "No data to add to for worker %d", worker_i);
  80   _data[worker_i] += value;
  81 }
  82 
  83 template <typename T>
  84 double WorkerDataArray<T>::average() const {
  85   uint contributing_threads = 0;
  86   for (uint i = 0; i < _length; ++i) {
  87     if (get(i) != uninitialized()) {
  88       contributing_threads++;
  89     }
  90   }
  91   if (contributing_threads == 0) {
  92     return 0.0;
  93   }
  94   return sum() / (double) contributing_threads;
  95 }
  96 




  57 
  58 template <typename T>
  59 WorkerDataArray<T>::~WorkerDataArray() {
  60   FREE_C_HEAP_ARRAY(T, _data);
  61 }
  62 
  63 template <typename T>
  64 void WorkerDataArray<T>::link_thread_work_items(WorkerDataArray<size_t>* thread_work_items, uint index) {
  65   assert(index < MaxThreadWorkItems, "Tried to access thread work item %u (max %u)", index, MaxThreadWorkItems);
  66   _thread_work_items[index] = thread_work_items;
  67 }
  68 
  69 template <typename T>
  70 void WorkerDataArray<T>::set_thread_work_item(uint worker_i, size_t value, uint index) {
  71   assert(index < MaxThreadWorkItems, "Tried to access thread work item %u (max %u)", index, MaxThreadWorkItems);
  72   assert(_thread_work_items[index] != NULL, "No sub count");
  73   _thread_work_items[index]->set(worker_i, value);
  74 }
  75 
  76 template <typename T>
  77 void WorkerDataArray<T>::add_thread_work_item(uint worker_i, size_t value, uint index) {
  78   assert(index < MaxThreadWorkItems, "Tried to access thread work item %u (max %u)", index, MaxThreadWorkItems);
  79   assert(_thread_work_items[index] != NULL, "No sub count");
  80   _thread_work_items[index]->add(worker_i, value);
  81 }
  82 
  83 template <typename T>
  84 void WorkerDataArray<T>::add(uint worker_i, T value) {
  85   assert(worker_i < _length, "Worker %d is greater than max: %d", worker_i, _length);
  86   assert(_data[worker_i] != uninitialized(), "No data to add to for worker %d", worker_i);
  87   _data[worker_i] += value;
  88 }
  89 
  90 template <typename T>
  91 double WorkerDataArray<T>::average() const {
  92   uint contributing_threads = 0;
  93   for (uint i = 0; i < _length; ++i) {
  94     if (get(i) != uninitialized()) {
  95       contributing_threads++;
  96     }
  97   }
  98   if (contributing_threads == 0) {
  99     return 0.0;
 100   }
 101   return sum() / (double) contributing_threads;
 102 }
 103 


< prev index next >