src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hs-gc-g1-data-verify Sdiff src/share/vm/gc_implementation/g1

src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp

Print this page




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "gc_interface/gcCause.hpp"
  30 
  31 template <class T>
  32 class WorkerDataArray  : public CHeapObj<mtGC> {
  33   T*          _data;
  34   uint        _length;
  35   const char* _print_format;
  36   bool        _print_sum;
  37 


  38   // We are caching the sum and average to only have to calculate them once.
  39   // This is not done in an MT-safe way. It is intetened to allow single
  40   // threaded code to call sum() and average() multiple times in any order
  41   // without having to worry about the cost.
  42   bool   _has_new_data;
  43   T      _sum;
  44   double _average;
  45 
  46  public:
  47   WorkerDataArray(uint length, const char* print_format, bool print_sum = true) :
  48   _length(length), _print_format(print_format), _print_sum(print_sum), _has_new_data(true) {
  49     assert(length > 0, "Must have some workers to store data for");
  50     _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
  51   }
  52 
  53   ~WorkerDataArray() {
  54     FREE_C_HEAP_ARRAY(T, _data, mtGC);
  55   }
  56 
  57   void set(uint worker_i, T value) {




  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #ifndef SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP
  26 #define SHARE_VM_GC_IMPLEMENTATION_G1_G1GCPHASETIMESLOG_HPP
  27 
  28 #include "memory/allocation.hpp"
  29 #include "gc_interface/gcCause.hpp"
  30 
  31 template <class T>
  32 class WorkerDataArray  : public CHeapObj<mtGC> {
  33   T*          _data;
  34   uint        _length;
  35   const char* _print_format;
  36   bool        _print_sum;
  37 
  38   NOT_PRODUCT(static const T _uninitialized;)
  39 
  40   // We are caching the sum and average to only have to calculate them once.
  41   // This is not done in an MT-safe way. It is intetened to allow single
  42   // threaded code to call sum() and average() multiple times in any order
  43   // without having to worry about the cost.
  44   bool   _has_new_data;
  45   T      _sum;
  46   double _average;
  47 
  48  public:
  49   WorkerDataArray(uint length, const char* print_format, bool print_sum = true) :
  50   _length(length), _print_format(print_format), _print_sum(print_sum), _has_new_data(true) {
  51     assert(length > 0, "Must have some workers to store data for");
  52     _data = NEW_C_HEAP_ARRAY(T, _length, mtGC);
  53   }
  54 
  55   ~WorkerDataArray() {
  56     FREE_C_HEAP_ARRAY(T, _data, mtGC);
  57   }
  58 
  59   void set(uint worker_i, T value) {


src/share/vm/gc_implementation/g1/g1GCPhaseTimes.hpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File