--- a/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp Mon Aug 09 05:41:05 2010 -0700
+++ b/hotspot/src/share/vm/gc_implementation/parNew/parNewGeneration.hpp Mon Aug 09 18:03:50 2010 -0700
@@ -36,9 +36,6 @@
typedef Padded<OopTaskQueue> ObjToScanQueue;
typedef GenericTaskQueueSet<ObjToScanQueue> ObjToScanQueueSet;
-// Enable this to get push/pop/steal stats.
-const int PAR_STATS_ENABLED = 0;
-
class ParKeepAliveClosure: public DefNewGeneration::KeepAliveClosure {
private:
ParScanWeakRefClosure* _par_cl;
@@ -94,8 +91,11 @@
bool _to_space_full;
- int _pushes, _pops, _steals, _steal_attempts, _term_attempts;
- int _overflow_pushes, _overflow_refills, _overflow_refill_objs;
+#if TASKQUEUE_STATS
+ size_t _term_attempts;
+ size_t _overflow_refills;
+ size_t _overflow_refill_objs;
+#endif // TASKQUEUE_STATS
// Stats for promotion failure
size_t _promotion_failure_size;
@@ -181,45 +181,38 @@
}
void print_and_clear_promotion_failure_size();
- int pushes() { return _pushes; }
- int pops() { return _pops; }
- int steals() { return _steals; }
- int steal_attempts() { return _steal_attempts; }
- int term_attempts() { return _term_attempts; }
- int overflow_pushes() { return _overflow_pushes; }
- int overflow_refills() { return _overflow_refills; }
- int overflow_refill_objs() { return _overflow_refill_objs; }
+#if TASKQUEUE_STATS
+ TaskQueueStats & taskqueue_stats() const { return _work_queue->stats; }
+
+ size_t term_attempts() const { return _term_attempts; }
+ size_t overflow_refills() const { return _overflow_refills; }
+ size_t overflow_refill_objs() const { return _overflow_refill_objs; }
- void note_push() { if (PAR_STATS_ENABLED) _pushes++; }
- void note_pop() { if (PAR_STATS_ENABLED) _pops++; }
- void note_steal() { if (PAR_STATS_ENABLED) _steals++; }
- void note_steal_attempt() { if (PAR_STATS_ENABLED) _steal_attempts++; }
- void note_term_attempt() { if (PAR_STATS_ENABLED) _term_attempts++; }
- void note_overflow_push() { if (PAR_STATS_ENABLED) _overflow_pushes++; }
- void note_overflow_refill(int objs) {
- if (PAR_STATS_ENABLED) {
- _overflow_refills++;
- _overflow_refill_objs += objs;
- }
+ void note_term_attempt() { ++_term_attempts; }
+ void note_overflow_refill(size_t objs) {
+ ++_overflow_refills; _overflow_refill_objs += objs;
}
+ void reset_stats();
+#endif // TASKQUEUE_STATS
+
void start_strong_roots() {
_start_strong_roots = os::elapsedTime();
}
void end_strong_roots() {
_strong_roots_time += (os::elapsedTime() - _start_strong_roots);
}
- double strong_roots_time() { return _strong_roots_time; }
+ double strong_roots_time() const { return _strong_roots_time; }
void start_term_time() {
- note_term_attempt();
+ TASKQUEUE_STATS_ONLY(note_term_attempt());
_start_term = os::elapsedTime();
}
void end_term_time() {
_term_time += (os::elapsedTime() - _start_term);
}
- double term_time() { return _term_time; }
+ double term_time() const { return _term_time; }
- double elapsed() {
+ double elapsed_time() const {
return os::elapsedTime() - _start;
}
};