hotspot/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp
changeset 4481 de92ec484f5e
parent 4022 2ec87d5043f7
child 5547 f4b087cbb361
equal deleted inserted replaced
4474:faa140ac71cd 4481:de92ec484f5e
    38 
    38 
    39   // The refinement threads collection is linked list. A predecessor can activate a successor
    39   // The refinement threads collection is linked list. A predecessor can activate a successor
    40   // when the number of the rset update buffer crosses a certain threshold. A successor
    40   // when the number of the rset update buffer crosses a certain threshold. A successor
    41   // would self-deactivate when the number of the buffers falls below the threshold.
    41   // would self-deactivate when the number of the buffers falls below the threshold.
    42   bool _active;
    42   bool _active;
    43   ConcurrentG1RefineThread *       _next;
    43   ConcurrentG1RefineThread* _next;
    44  public:
    44   Monitor* _monitor;
    45   virtual void run();
    45   ConcurrentG1Refine* _cg1r;
    46 
    46 
    47   bool is_active()  { return _active;  }
    47   int _thread_threshold_step;
    48   void activate()   { _active = true;  }
    48   // This thread activation threshold
    49   void deactivate() { _active = false; }
    49   int _threshold;
       
    50   // This thread deactivation threshold
       
    51   int _deactivation_threshold;
    50 
    52 
    51  private:
    53   void sample_young_list_rs_lengths();
    52   ConcurrentG1Refine*              _cg1r;
    54   void run_young_rs_sampling();
       
    55   void wait_for_completed_buffers();
    53 
    56 
    54   double                           _interval_ms;
    57   void set_active(bool x) { _active = x; }
    55 
    58   bool is_active();
    56   void decreaseInterval(int processing_time_ms) {
    59   void activate();
    57     double min_interval_ms = (double) processing_time_ms;
    60   void deactivate();
    58     _interval_ms = 0.8 * _interval_ms;
       
    59     if (_interval_ms < min_interval_ms)
       
    60       _interval_ms = min_interval_ms;
       
    61   }
       
    62   void increaseInterval(int processing_time_ms) {
       
    63     double max_interval_ms = 9.0 * (double) processing_time_ms;
       
    64     _interval_ms = 1.1 * _interval_ms;
       
    65     if (max_interval_ms > 0 && _interval_ms > max_interval_ms)
       
    66       _interval_ms = max_interval_ms;
       
    67   }
       
    68 
       
    69   void sleepBeforeNextCycle();
       
    70 
    61 
    71   // For use by G1CollectedHeap, which is a friend.
    62   // For use by G1CollectedHeap, which is a friend.
    72   static SuspendibleThreadSet* sts() { return &_sts; }
    63   static SuspendibleThreadSet* sts() { return &_sts; }
    73 
    64 
    74  public:
    65 public:
       
    66   virtual void run();
    75   // Constructor
    67   // Constructor
    76   ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread* next,
    68   ConcurrentG1RefineThread(ConcurrentG1Refine* cg1r, ConcurrentG1RefineThread* next,
    77                            int worker_id_offset, int worker_id);
    69                            int worker_id_offset, int worker_id);
       
    70 
       
    71   void initialize();
    78 
    72 
    79   // Printing
    73   // Printing
    80   void print() const;
    74   void print() const;
    81   void print_on(outputStream* st) const;
    75   void print_on(outputStream* st) const;
    82 
    76 
    83   // Total virtual time so far.
    77   // Total virtual time so far.
    84   double vtime_accum() { return _vtime_accum; }
    78   double vtime_accum() { return _vtime_accum; }
    85 
    79 
    86   ConcurrentG1Refine* cg1r()                     { return _cg1r;     }
    80   ConcurrentG1Refine* cg1r() { return _cg1r;     }
    87 
       
    88   void            sample_young_list_rs_lengths();
       
    89 
    81 
    90   // Yield for GC
    82   // Yield for GC
    91   void            yield();
    83   void yield();
    92 
       
    93   // shutdown
    84   // shutdown
    94   void stop();
    85   void stop();
    95 };
    86 };