1.1 --- a/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp Mon Aug 09 05:41:05 2010 -0700 1.2 +++ b/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp Mon Aug 09 18:03:50 2010 -0700 1.3 @@ -36,9 +36,6 @@ 1.4 typedef Padded<OopTaskQueue> ObjToScanQueue; 1.5 typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet; 1.6 1.7 -// Enable this to get push/pop/steal stats. 1.8 -const int PAR_STATS_ENABLED = 0; 1.9 - 1.10 class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure { 1.11 private: 1.12 ParScanWeakRefClosure* _par_cl; 1.13 @@ -94,8 +91,11 @@ 1.14 1.15 bool _to_space_full; 1.16 1.17 - int _pushes, _pops, _steals, _steal_attempts, _term_attempts; 1.18 - int _overflow_pushes, _overflow_refills, _overflow_refill_objs; 1.19 +#if TASKQUEUE_STATS 1.20 + size_t _term_attempts; 1.21 + size_t _overflow_refills; 1.22 + size_t _overflow_refill_objs; 1.23 +#endif // TASKQUEUE_STATS 1.24 1.25 // Stats for promotion failure 1.26 size_t _promotion_failure_size; 1.27 @@ -181,45 +181,38 @@ 1.28 } 1.29 void print_and_clear_promotion_failure_size(); 1.30 1.31 - int pushes() { return _pushes; } 1.32 - int pops() { return _pops; } 1.33 - int steals() { return _steals; } 1.34 - int steal_attempts() { return _steal_attempts; } 1.35 - int term_attempts() { return _term_attempts; } 1.36 - int overflow_pushes() { return _overflow_pushes; } 1.37 - int overflow_refills() { return _overflow_refills; } 1.38 - int overflow_refill_objs() { return _overflow_refill_objs; } 1.39 +#if TASKQUEUE_STATS 1.40 + TaskQueueStats & taskqueue_stats() const { return _work_queue->stats; } 1.41 1.42 - void note_push() { if (PAR_STATS_ENABLED) _pushes++; } 1.43 - void note_pop() { if (PAR_STATS_ENABLED) _pops++; } 1.44 - void note_steal() { if (PAR_STATS_ENABLED) _steals++; } 1.45 - void note_steal_attempt() { if (PAR_STATS_ENABLED) _steal_attempts++; } 1.46 - void note_term_attempt() { if (PAR_STATS_ENABLED) _term_attempts++; } 1.47 - void note_overflow_push() { if (PAR_STATS_ENABLED) _overflow_pushes++; } 1.48 - void note_overflow_refill(int objs) { 1.49 - if (PAR_STATS_ENABLED) { 1.50 - _overflow_refills++; 1.51 - _overflow_refill_objs += objs; 1.52 - } 1.53 + size_t term_attempts() const { return _term_attempts; } 1.54 + size_t overflow_refills() const { return _overflow_refills; } 1.55 + size_t overflow_refill_objs() const { return _overflow_refill_objs; } 1.56 + 1.57 + void note_term_attempt() { ++_term_attempts; } 1.58 + void note_overflow_refill(size_t objs) { 1.59 + ++_overflow_refills; _overflow_refill_objs += objs; 1.60 } 1.61 1.62 + void reset_stats(); 1.63 +#endif // TASKQUEUE_STATS 1.64 + 1.65 void start_strong_roots() { 1.66 _start_strong_roots = os::elapsedTime(); 1.67 } 1.68 void end_strong_roots() { 1.69 _strong_roots_time += (os::elapsedTime() - _start_strong_roots); 1.70 } 1.71 - double strong_roots_time() { return _strong_roots_time; } 1.72 + double strong_roots_time() const { return _strong_roots_time; } 1.73 void start_term_time() { 1.74 - note_term_attempt(); 1.75 + TASKQUEUE_STATS_ONLY(note_term_attempt()); 1.76 _start_term = os::elapsedTime(); 1.77 } 1.78 void end_term_time() { 1.79 _term_time += (os::elapsedTime() - _start_term); 1.80 } 1.81 - double term_time() { return _term_time; } 1.82 + double term_time() const { return _term_time; } 1.83 1.84 - double elapsed() { 1.85 + double elapsed_time() const { 1.86 return os::elapsedTime() - _start; 1.87 } 1.88 };