Wed, 19 Aug 2009 12:53:25 -0400
6871111: G1: remove the concurrent overhead tracker
Summary: Removing the concurrent overhead tracker from G1, along with the GC overhead reporter and the G1AccountConcurrentOverhead (both of which rely on the the concurrent overhead tracker).
Reviewed-by: iveresov, johnc
1.1 --- a/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp Fri Aug 14 13:44:15 2009 -0700 1.2 +++ b/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.cpp Wed Aug 19 12:53:25 2009 -0400 1.3 @@ -39,7 +39,6 @@ 1.4 _next(next), 1.5 _cg1r(cg1r), 1.6 _vtime_accum(0.0), 1.7 - _co_tracker(G1CRGroup), 1.8 _interval_ms(5.0) 1.9 { 1.10 create_and_start(); 1.11 @@ -76,9 +75,6 @@ 1.12 _vtime_start = os::elapsedVTime(); 1.13 wait_for_universe_init(); 1.14 1.15 - _co_tracker.enable(); 1.16 - _co_tracker.start(); 1.17 - 1.18 while (!_should_terminate) { 1.19 DirtyCardQueueSet& dcqs = JavaThread::dirty_card_queue_set(); 1.20 // Wait for completed log buffers to exist. 1.21 @@ -147,7 +143,6 @@ 1.22 } 1.23 break; 1.24 } 1.25 - _co_tracker.update(false); 1.26 1.27 // Check if we need to activate the next thread. 1.28 if (curr_buffer_num > next_threshold && _next != NULL && !_next->is_active()) { 1.29 @@ -168,7 +163,6 @@ 1.30 } 1.31 n_logs++; 1.32 } 1.33 - _co_tracker.update(false); 1.34 _sts.leave(); 1.35 1.36 if (os::supports_vtime()) { 1.37 @@ -177,9 +171,6 @@ 1.38 _vtime_accum = 0.0; 1.39 } 1.40 } 1.41 - _sts.join(); 1.42 - _co_tracker.update(true); 1.43 - _sts.leave(); 1.44 assert(_should_terminate, "just checking"); 1.45 1.46 terminate();
2.1 --- a/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp Fri Aug 14 13:44:15 2009 -0700 2.2 +++ b/src/share/vm/gc_implementation/g1/concurrentG1RefineThread.hpp Wed Aug 19 12:53:25 2009 -0400 2.3 @@ -51,7 +51,6 @@ 2.4 private: 2.5 ConcurrentG1Refine* _cg1r; 2.6 2.7 - COTracker _co_tracker; 2.8 double _interval_ms; 2.9 2.10 void decreaseInterval(int processing_time_ms) {
3.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.cpp Fri Aug 14 13:44:15 2009 -0700 3.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.cpp Wed Aug 19 12:53:25 2009 -0400 3.3 @@ -433,8 +433,7 @@ 3.4 _total_counting_time(0.0), 3.5 _total_rs_scrub_time(0.0), 3.6 3.7 - _parallel_workers(NULL), 3.8 - _cleanup_co_tracker(G1CLGroup) 3.9 + _parallel_workers(NULL) 3.10 { 3.11 CMVerboseLevel verbose_level = 3.12 (CMVerboseLevel) G1MarkingVerboseLevel; 3.13 @@ -823,18 +822,6 @@ 3.14 // when marking is on. So, it's also called at the end of the 3.15 // initial-mark pause to update the heap end, if the heap expands 3.16 // during it. No need to call it here. 3.17 - 3.18 - guarantee( !_cleanup_co_tracker.enabled(), "invariant" ); 3.19 - 3.20 - size_t max_marking_threads = 3.21 - MAX2((size_t) 1, parallel_marking_threads()); 3.22 - for (int i = 0; i < (int)_max_task_num; ++i) { 3.23 - _tasks[i]->enable_co_tracker(); 3.24 - if (i < (int) max_marking_threads) 3.25 - _tasks[i]->reset_co_tracker(marking_task_overhead()); 3.26 - else 3.27 - _tasks[i]->reset_co_tracker(0.0); 3.28 - } 3.29 } 3.30 3.31 // Checkpoint the roots into this generation from outside 3.32 @@ -845,7 +832,6 @@ 3.33 G1CollectedHeap* g1h = G1CollectedHeap::heap(); 3.34 3.35 double start = os::elapsedTime(); 3.36 - GCOverheadReporter::recordSTWStart(start); 3.37 3.38 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 3.39 g1p->record_concurrent_mark_init_start(); 3.40 @@ -876,7 +862,6 @@ 3.41 // Statistics. 3.42 double end = os::elapsedTime(); 3.43 _init_times.add((end - start) * 1000.0); 3.44 - GCOverheadReporter::recordSTWEnd(end); 3.45 3.46 g1p->record_concurrent_mark_init_end(); 3.47 } 3.48 @@ -1035,7 +1020,6 @@ 3.49 3.50 guarantee( (size_t)worker_i < _cm->active_tasks(), "invariant" ); 3.51 CMTask* the_task = _cm->task(worker_i); 3.52 - the_task->start_co_tracker(); 3.53 the_task->record_start_time(); 3.54 if (!_cm->has_aborted()) { 3.55 do { 3.56 @@ -1061,8 +1045,6 @@ 3.57 double end_time2_sec = os::elapsedTime(); 3.58 double elapsed_time2_sec = end_time2_sec - start_time_sec; 3.59 3.60 - the_task->update_co_tracker(); 3.61 - 3.62 #if 0 3.63 gclog_or_tty->print_cr("CM: elapsed %1.4lf ms, sleep %1.4lf ms, " 3.64 "overhead %1.4lf", 3.65 @@ -1079,7 +1061,6 @@ 3.66 ConcurrentGCThread::stsLeave(); 3.67 3.68 double end_vtime = os::elapsedVTime(); 3.69 - the_task->update_co_tracker(true); 3.70 _cm->update_accum_task_vtime(worker_i, end_vtime - start_vtime); 3.71 } 3.72 3.73 @@ -1133,7 +1114,6 @@ 3.74 g1p->record_concurrent_mark_remark_start(); 3.75 3.76 double start = os::elapsedTime(); 3.77 - GCOverheadReporter::recordSTWStart(start); 3.78 3.79 checkpointRootsFinalWork(); 3.80 3.81 @@ -1173,11 +1153,6 @@ 3.82 _remark_weak_ref_times.add((now - mark_work_end) * 1000.0); 3.83 _remark_times.add((now - start) * 1000.0); 3.84 3.85 - GCOverheadReporter::recordSTWEnd(now); 3.86 - for (int i = 0; i < (int)_max_task_num; ++i) 3.87 - _tasks[i]->disable_co_tracker(); 3.88 - _cleanup_co_tracker.enable(); 3.89 - _cleanup_co_tracker.reset(cleanup_task_overhead()); 3.90 g1p->record_concurrent_mark_remark_end(); 3.91 } 3.92 3.93 @@ -1188,7 +1163,6 @@ 3.94 3.95 CMBitMapRO* _bm; 3.96 ConcurrentMark* _cm; 3.97 - COTracker* _co_tracker; 3.98 bool _changed; 3.99 bool _yield; 3.100 size_t _words_done; 3.101 @@ -1216,12 +1190,10 @@ 3.102 public: 3.103 CalcLiveObjectsClosure(bool final, 3.104 CMBitMapRO *bm, ConcurrentMark *cm, 3.105 - BitMap* region_bm, BitMap* card_bm, 3.106 - COTracker* co_tracker) : 3.107 + BitMap* region_bm, BitMap* card_bm) : 3.108 _bm(bm), _cm(cm), _changed(false), _yield(true), 3.109 _words_done(0), _tot_live(0), _tot_used(0), 3.110 - _region_bm(region_bm), _card_bm(card_bm), 3.111 - _final(final), _co_tracker(co_tracker), 3.112 + _region_bm(region_bm), _card_bm(card_bm),_final(final), 3.113 _regions_done(0), _start_vtime_sec(0.0) 3.114 { 3.115 _bottom_card_num = 3.116 @@ -1265,9 +1237,6 @@ 3.117 } 3.118 3.119 bool doHeapRegion(HeapRegion* hr) { 3.120 - if (_co_tracker != NULL) 3.121 - _co_tracker->update(); 3.122 - 3.123 if (!_final && _regions_done == 0) 3.124 _start_vtime_sec = os::elapsedVTime(); 3.125 3.126 @@ -1396,12 +1365,6 @@ 3.127 if (elapsed_vtime_sec > (10.0 / 1000.0)) { 3.128 jlong sleep_time_ms = 3.129 (jlong) (elapsed_vtime_sec * _cm->cleanup_sleep_factor() * 1000.0); 3.130 -#if 0 3.131 - gclog_or_tty->print_cr("CL: elapsed %1.4lf ms, sleep %1.4lf ms, " 3.132 - "overhead %1.4lf", 3.133 - elapsed_vtime_sec * 1000.0, (double) sleep_time_ms, 3.134 - _co_tracker->concOverhead(os::elapsedTime())); 3.135 -#endif 3.136 os::sleep(Thread::current(), sleep_time_ms, false); 3.137 _start_vtime_sec = end_vtime_sec; 3.138 } 3.139 @@ -1421,15 +1384,11 @@ 3.140 3.141 3.142 void ConcurrentMark::calcDesiredRegions() { 3.143 - guarantee( _cleanup_co_tracker.enabled(), "invariant" ); 3.144 - _cleanup_co_tracker.start(); 3.145 - 3.146 _region_bm.clear(); 3.147 _card_bm.clear(); 3.148 CalcLiveObjectsClosure calccl(false /*final*/, 3.149 nextMarkBitMap(), this, 3.150 - &_region_bm, &_card_bm, 3.151 - &_cleanup_co_tracker); 3.152 + &_region_bm, &_card_bm); 3.153 G1CollectedHeap *g1h = G1CollectedHeap::heap(); 3.154 g1h->heap_region_iterate(&calccl); 3.155 3.156 @@ -1437,8 +1396,6 @@ 3.157 calccl.reset(); 3.158 g1h->heap_region_iterate(&calccl); 3.159 } while (calccl.changed()); 3.160 - 3.161 - _cleanup_co_tracker.update(true); 3.162 } 3.163 3.164 class G1ParFinalCountTask: public AbstractGangTask { 3.165 @@ -1472,8 +1429,7 @@ 3.166 void work(int i) { 3.167 CalcLiveObjectsClosure calccl(true /*final*/, 3.168 _bm, _g1h->concurrent_mark(), 3.169 - _region_bm, _card_bm, 3.170 - NULL /* CO tracker */); 3.171 + _region_bm, _card_bm); 3.172 calccl.no_yield(); 3.173 if (ParallelGCThreads > 0) { 3.174 _g1h->heap_region_par_iterate_chunked(&calccl, i, 3.175 @@ -1663,13 +1619,10 @@ 3.176 /* prev marking */ true); 3.177 } 3.178 3.179 - _cleanup_co_tracker.disable(); 3.180 - 3.181 G1CollectorPolicy* g1p = G1CollectedHeap::heap()->g1_policy(); 3.182 g1p->record_concurrent_mark_cleanup_start(); 3.183 3.184 double start = os::elapsedTime(); 3.185 - GCOverheadReporter::recordSTWStart(start); 3.186 3.187 // Do counting once more with the world stopped for good measure. 3.188 G1ParFinalCountTask g1_par_count_task(g1h, nextMarkBitMap(), 3.189 @@ -1774,7 +1727,6 @@ 3.190 // Statistics. 3.191 double end = os::elapsedTime(); 3.192 _cleanup_times.add((end - start) * 1000.0); 3.193 - GCOverheadReporter::recordSTWEnd(end); 3.194 3.195 // G1CollectedHeap::heap()->print(); 3.196 // gclog_or_tty->print_cr("HEAP GC TIME STAMP : %d", 3.197 @@ -2625,24 +2577,6 @@ 3.198 _should_gray_objects = true; 3.199 } 3.200 3.201 -void ConcurrentMark::disable_co_trackers() { 3.202 - if (has_aborted()) { 3.203 - if (_cleanup_co_tracker.enabled()) 3.204 - _cleanup_co_tracker.disable(); 3.205 - for (int i = 0; i < (int)_max_task_num; ++i) { 3.206 - CMTask* task = _tasks[i]; 3.207 - if (task->co_tracker_enabled()) 3.208 - task->disable_co_tracker(); 3.209 - } 3.210 - } else { 3.211 - guarantee( !_cleanup_co_tracker.enabled(), "invariant" ); 3.212 - for (int i = 0; i < (int)_max_task_num; ++i) { 3.213 - CMTask* task = _tasks[i]; 3.214 - guarantee( !task->co_tracker_enabled(), "invariant" ); 3.215 - } 3.216 - } 3.217 -} 3.218 - 3.219 // abandon current marking iteration due to a Full GC 3.220 void ConcurrentMark::abort() { 3.221 // Clear all marks to force marking thread to do nothing 3.222 @@ -4018,7 +3952,6 @@ 3.223 CMTaskQueue* task_queue, 3.224 CMTaskQueueSet* task_queues) 3.225 : _g1h(G1CollectedHeap::heap()), 3.226 - _co_tracker(G1CMGroup), 3.227 _task_id(task_id), _cm(cm), 3.228 _claimed(false), 3.229 _nextMarkBitMap(NULL), _hash_seed(17),
4.1 --- a/src/share/vm/gc_implementation/g1/concurrentMark.hpp Fri Aug 14 13:44:15 2009 -0700 4.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMark.hpp Wed Aug 19 12:53:25 2009 -0400 4.3 @@ -407,8 +407,6 @@ 4.4 // verbose level 4.5 CMVerboseLevel _verbose_level; 4.6 4.7 - COTracker _cleanup_co_tracker; 4.8 - 4.9 // These two fields are used to implement the optimisation that 4.10 // avoids pushing objects on the global/region stack if there are 4.11 // no collection set regions above the lowest finger. 4.12 @@ -720,8 +718,6 @@ 4.13 // Called to abort the marking cycle after a Full GC takes palce. 4.14 void abort(); 4.15 4.16 - void disable_co_trackers(); 4.17 - 4.18 // This prints the global/local fingers. It is used for debugging. 4.19 NOT_PRODUCT(void print_finger();) 4.20 4.21 @@ -773,9 +769,6 @@ 4.22 // number of calls to this task 4.23 int _calls; 4.24 4.25 - // concurrent overhead over a single CPU for this task 4.26 - COTracker _co_tracker; 4.27 - 4.28 // when the virtual timer reaches this time, the marking step should 4.29 // exit 4.30 double _time_target_ms; 4.31 @@ -928,27 +921,6 @@ 4.32 4.33 void set_concurrent(bool concurrent) { _concurrent = concurrent; } 4.34 4.35 - void enable_co_tracker() { 4.36 - guarantee( !_co_tracker.enabled(), "invariant" ); 4.37 - _co_tracker.enable(); 4.38 - } 4.39 - void disable_co_tracker() { 4.40 - guarantee( _co_tracker.enabled(), "invariant" ); 4.41 - _co_tracker.disable(); 4.42 - } 4.43 - bool co_tracker_enabled() { 4.44 - return _co_tracker.enabled(); 4.45 - } 4.46 - void reset_co_tracker(double starting_conc_overhead = 0.0) { 4.47 - _co_tracker.reset(starting_conc_overhead); 4.48 - } 4.49 - void start_co_tracker() { 4.50 - _co_tracker.start(); 4.51 - } 4.52 - void update_co_tracker(bool force_end = false) { 4.53 - _co_tracker.update(force_end); 4.54 - } 4.55 - 4.56 // The main method of this class which performs a marking step 4.57 // trying not to exceed the given duration. However, it might exit 4.58 // prematurely, according to some conditions (i.e. SATB buffers are
5.1 --- a/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp Fri Aug 14 13:44:15 2009 -0700 5.2 +++ b/src/share/vm/gc_implementation/g1/concurrentMarkThread.cpp Wed Aug 19 12:53:25 2009 -0400 5.3 @@ -260,10 +260,6 @@ 5.4 } 5.5 } 5.6 5.7 - _sts.join(); 5.8 - _cm->disable_co_trackers(); 5.9 - _sts.leave(); 5.10 - 5.11 // we now want to allow clearing of the marking bitmap to be 5.12 // suspended by a collection pause. 5.13 _sts.join();
6.1 --- a/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp Fri Aug 14 13:44:15 2009 -0700 6.2 +++ b/src/share/vm/gc_implementation/g1/concurrentZFThread.cpp Wed Aug 19 12:53:25 2009 -0400 6.3 @@ -35,8 +35,7 @@ 6.4 int ConcurrentZFThread::_regions_filled = 0; 6.5 6.6 ConcurrentZFThread::ConcurrentZFThread() : 6.7 - ConcurrentGCThread(), 6.8 - _co_tracker(G1ZFGroup) 6.9 + ConcurrentGCThread() 6.10 { 6.11 create_and_start(); 6.12 } 6.13 @@ -71,8 +70,6 @@ 6.14 Thread* thr_self = Thread::current(); 6.15 _vtime_start = os::elapsedVTime(); 6.16 wait_for_universe_init(); 6.17 - _co_tracker.enable(); 6.18 - _co_tracker.start(); 6.19 6.20 G1CollectedHeap* g1 = G1CollectedHeap::heap(); 6.21 _sts.join(); 6.22 @@ -135,10 +132,7 @@ 6.23 } 6.24 _vtime_accum = (os::elapsedVTime() - _vtime_start); 6.25 _sts.join(); 6.26 - 6.27 - _co_tracker.update(); 6.28 } 6.29 - _co_tracker.update(false); 6.30 _sts.leave(); 6.31 6.32 assert(_should_terminate, "just checking");
7.1 --- a/src/share/vm/gc_implementation/g1/concurrentZFThread.hpp Fri Aug 14 13:44:15 2009 -0700 7.2 +++ b/src/share/vm/gc_implementation/g1/concurrentZFThread.hpp Wed Aug 19 12:53:25 2009 -0400 7.3 @@ -42,8 +42,6 @@ 7.4 // Number of regions CFZ thread fills. 7.5 static int _regions_filled; 7.6 7.7 - COTracker _co_tracker; 7.8 - 7.9 double _vtime_start; // Initial virtual time. 7.10 7.11 // These are static because the "print_summary_info" method is, and
8.1 --- a/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Fri Aug 14 13:44:15 2009 -0700 8.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectedHeap.cpp Wed Aug 19 12:53:25 2009 -0400 8.3 @@ -927,7 +927,6 @@ 8.4 TraceTime t(full ? "Full GC (System.gc())" : "Full GC", PrintGC, true, gclog_or_tty); 8.5 8.6 double start = os::elapsedTime(); 8.7 - GCOverheadReporter::recordSTWStart(start); 8.8 g1_policy()->record_full_collection_start(); 8.9 8.10 gc_prologue(true); 8.11 @@ -1049,7 +1048,6 @@ 8.12 } 8.13 8.14 double end = os::elapsedTime(); 8.15 - GCOverheadReporter::recordSTWEnd(end); 8.16 g1_policy()->record_full_collection_end(); 8.17 8.18 #ifdef TRACESPINNING 8.19 @@ -1610,9 +1608,6 @@ 8.20 // Do later initialization work for concurrent refinement. 8.21 _cg1r->init(); 8.22 8.23 - const char* group_names[] = { "CR", "ZF", "CM", "CL" }; 8.24 - GCOverheadReporter::initGCOverheadReporter(4, group_names); 8.25 - 8.26 return JNI_OK; 8.27 } 8.28 8.29 @@ -2431,8 +2426,6 @@ 8.30 } 8.31 g1_policy()->print_yg_surv_rate_info(); 8.32 8.33 - GCOverheadReporter::printGCOverhead(); 8.34 - 8.35 SpecializationStats::print(); 8.36 } 8.37 8.38 @@ -2669,7 +2662,6 @@ 8.39 // The elapsed time induced by the start time below deliberately elides 8.40 // the possible verification above. 8.41 double start_time_sec = os::elapsedTime(); 8.42 - GCOverheadReporter::recordSTWStart(start_time_sec); 8.43 size_t start_used_bytes = used(); 8.44 8.45 g1_policy()->record_collection_pause_start(start_time_sec, 8.46 @@ -2798,7 +2790,6 @@ 8.47 double end_time_sec = os::elapsedTime(); 8.48 double pause_time_ms = (end_time_sec - start_time_sec) * MILLIUNITS; 8.49 g1_policy()->record_pause_time_ms(pause_time_ms); 8.50 - GCOverheadReporter::recordSTWEnd(end_time_sec); 8.51 g1_policy()->record_collection_pause_end(abandoned); 8.52 8.53 assert(regions_accounted_for(), "Region leakage.");
9.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Fri Aug 14 13:44:15 2009 -0700 9.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.cpp Wed Aug 19 12:53:25 2009 -0400 9.3 @@ -993,8 +993,6 @@ 9.4 double full_gc_time_sec = end_sec - _cur_collection_start_sec; 9.5 double full_gc_time_ms = full_gc_time_sec * 1000.0; 9.6 9.7 - checkpoint_conc_overhead(); 9.8 - 9.9 _all_full_gc_times_ms->add(full_gc_time_ms); 9.10 9.11 update_recent_gc_times(end_sec, full_gc_time_ms); 9.12 @@ -1164,7 +1162,6 @@ 9.13 double end_time_sec = os::elapsedTime(); 9.14 double elapsed_time_ms = (end_time_sec - _mark_init_start_sec) * 1000.0; 9.15 _concurrent_mark_init_times_ms->add(elapsed_time_ms); 9.16 - checkpoint_conc_overhead(); 9.17 record_concurrent_mark_init_end_pre(elapsed_time_ms); 9.18 9.19 _mmu_tracker->add_pause(_mark_init_start_sec, end_time_sec, true); 9.20 @@ -1178,7 +1175,6 @@ 9.21 void G1CollectorPolicy::record_concurrent_mark_remark_end() { 9.22 double end_time_sec = os::elapsedTime(); 9.23 double elapsed_time_ms = (end_time_sec - _mark_remark_start_sec)*1000.0; 9.24 - checkpoint_conc_overhead(); 9.25 _concurrent_mark_remark_times_ms->add(elapsed_time_ms); 9.26 _cur_mark_stop_world_time_ms += elapsed_time_ms; 9.27 _prev_collection_pause_end_ms += elapsed_time_ms; 9.28 @@ -1210,7 +1206,6 @@ 9.29 9.30 // The important thing about this is that it includes "os::elapsedTime". 9.31 void G1CollectorPolicy::record_concurrent_mark_cleanup_end_work2() { 9.32 - checkpoint_conc_overhead(); 9.33 double end_time_sec = os::elapsedTime(); 9.34 double elapsed_time_ms = (end_time_sec - _mark_cleanup_start_sec)*1000.0; 9.35 _concurrent_mark_cleanup_times_ms->add(elapsed_time_ms); 9.36 @@ -1425,8 +1420,6 @@ 9.37 } 9.38 #endif // PRODUCT 9.39 9.40 - checkpoint_conc_overhead(); 9.41 - 9.42 if (in_young_gc_mode()) { 9.43 last_pause_included_initial_mark = _should_initiate_conc_mark; 9.44 if (last_pause_included_initial_mark) 9.45 @@ -2525,19 +2518,6 @@ 9.46 } 9.47 #endif // PRODUCT 9.48 9.49 -void 9.50 -G1CollectorPolicy::checkpoint_conc_overhead() { 9.51 - double conc_overhead = 0.0; 9.52 - if (G1AccountConcurrentOverhead) 9.53 - conc_overhead = COTracker::totalPredConcOverhead(); 9.54 - _mmu_tracker->update_conc_overhead(conc_overhead); 9.55 -#if 0 9.56 - gclog_or_tty->print(" CO %1.4lf TARGET %1.4lf", 9.57 - conc_overhead, _mmu_tracker->max_gc_time()); 9.58 -#endif 9.59 -} 9.60 - 9.61 - 9.62 size_t G1CollectorPolicy::max_regions(int purpose) { 9.63 switch (purpose) { 9.64 case GCAllocForSurvived:
10.1 --- a/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Fri Aug 14 13:44:15 2009 -0700 10.2 +++ b/src/share/vm/gc_implementation/g1/g1CollectorPolicy.hpp Wed Aug 19 12:53:25 2009 -0400 10.3 @@ -981,8 +981,6 @@ 10.4 void set_should_initiate_conc_mark() { _should_initiate_conc_mark = true; } 10.5 void unset_should_initiate_conc_mark(){ _should_initiate_conc_mark = false; } 10.6 10.7 - void checkpoint_conc_overhead(); 10.8 - 10.9 // If an expansion would be appropriate, because recent GC overhead had 10.10 // exceeded the desired limit, return an amount to expand by. 10.11 virtual size_t expansion_amount();
11.1 --- a/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp Fri Aug 14 13:44:15 2009 -0700 11.2 +++ b/src/share/vm/gc_implementation/g1/g1MMUTracker.cpp Wed Aug 19 12:53:25 2009 -0400 11.3 @@ -37,21 +37,7 @@ 11.4 11.5 G1MMUTracker::G1MMUTracker(double time_slice, double max_gc_time) : 11.6 _time_slice(time_slice), 11.7 - _max_gc_time(max_gc_time), 11.8 - _conc_overhead_time_sec(0.0) { } 11.9 - 11.10 -void 11.11 -G1MMUTracker::update_conc_overhead(double conc_overhead) { 11.12 - double conc_overhead_time_sec = _time_slice * conc_overhead; 11.13 - if (conc_overhead_time_sec > 0.9 * _max_gc_time) { 11.14 - // We are screwed, as we only seem to have <10% of the soft 11.15 - // real-time goal available for pauses. Let's admit defeat and 11.16 - // allow something more generous as a pause target. 11.17 - conc_overhead_time_sec = 0.75 * _max_gc_time; 11.18 - } 11.19 - 11.20 - _conc_overhead_time_sec = conc_overhead_time_sec; 11.21 -} 11.22 + _max_gc_time(max_gc_time) { } 11.23 11.24 G1MMUTrackerQueue::G1MMUTrackerQueue(double time_slice, double max_gc_time) : 11.25 G1MMUTracker(time_slice, max_gc_time), 11.26 @@ -128,7 +114,7 @@ 11.27 11.28 while( 1 ) { 11.29 double gc_time = 11.30 - calculate_gc_time(current_time + target_time) + _conc_overhead_time_sec; 11.31 + calculate_gc_time(current_time + target_time); 11.32 double diff = target_time + gc_time - _max_gc_time; 11.33 if (!is_double_leq_0(diff)) { 11.34 target_time -= diff;
12.1 --- a/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp Fri Aug 14 13:44:15 2009 -0700 12.2 +++ b/src/share/vm/gc_implementation/g1/g1MMUTracker.hpp Wed Aug 19 12:53:25 2009 -0400 12.3 @@ -33,19 +33,15 @@ 12.4 double _time_slice; 12.5 double _max_gc_time; // this is per time slice 12.6 12.7 - double _conc_overhead_time_sec; 12.8 - 12.9 public: 12.10 G1MMUTracker(double time_slice, double max_gc_time); 12.11 12.12 - void update_conc_overhead(double conc_overhead); 12.13 - 12.14 virtual void add_pause(double start, double end, bool gc_thread) = 0; 12.15 virtual double longest_pause(double current_time) = 0; 12.16 virtual double when_sec(double current_time, double pause_time) = 0; 12.17 12.18 double max_gc_time() { 12.19 - return _max_gc_time - _conc_overhead_time_sec; 12.20 + return _max_gc_time; 12.21 } 12.22 12.23 inline bool now_max_gc(double current_time) {
13.1 --- a/src/share/vm/gc_implementation/g1/g1_globals.hpp Fri Aug 14 13:44:15 2009 -0700 13.2 +++ b/src/share/vm/gc_implementation/g1/g1_globals.hpp Wed Aug 19 12:53:25 2009 -0400 13.3 @@ -37,10 +37,6 @@ 13.4 develop(intx, G1MarkingOverheadPercent, 0, \ 13.5 "Overhead of concurrent marking") \ 13.6 \ 13.7 - develop(bool, G1AccountConcurrentOverhead, false, \ 13.8 - "Whether soft real-time compliance in G1 will take into account" \ 13.9 - "concurrent overhead") \ 13.10 - \ 13.11 product(intx, G1YoungGenSize, 0, \ 13.12 "Size of the G1 young generation, 0 is the adaptive policy") \ 13.13 \
14.1 --- a/src/share/vm/gc_implementation/includeDB_gc_g1 Fri Aug 14 13:44:15 2009 -0700 14.2 +++ b/src/share/vm/gc_implementation/includeDB_gc_g1 Wed Aug 19 12:53:25 2009 -0400 14.3 @@ -64,14 +64,12 @@ 14.4 concurrentG1RefineThread.cpp resourceArea.hpp 14.5 14.6 concurrentG1RefineThread.hpp concurrentGCThread.hpp 14.7 -concurrentG1RefineThread.hpp coTracker.hpp 14.8 14.9 concurrentMark.cpp concurrentMark.hpp 14.10 concurrentMark.cpp concurrentMarkThread.inline.hpp 14.11 concurrentMark.cpp g1CollectedHeap.inline.hpp 14.12 concurrentMark.cpp g1CollectorPolicy.hpp 14.13 concurrentMark.cpp g1RemSet.hpp 14.14 -concurrentMark.cpp gcOverheadReporter.hpp 14.15 concurrentMark.cpp genOopClosures.inline.hpp 14.16 concurrentMark.cpp heapRegionRemSet.hpp 14.17 concurrentMark.cpp heapRegionSeq.inline.hpp 14.18 @@ -82,7 +80,6 @@ 14.19 concurrentMark.cpp resourceArea.hpp 14.20 concurrentMark.cpp symbolTable.hpp 14.21 14.22 -concurrentMark.hpp coTracker.hpp 14.23 concurrentMark.hpp heapRegion.hpp 14.24 concurrentMark.hpp taskqueue.hpp 14.25 14.26 @@ -107,7 +104,6 @@ 14.27 concurrentZFThread.cpp space.inline.hpp 14.28 14.29 concurrentZFThread.hpp concurrentGCThread.hpp 14.30 -concurrentZFThread.hpp coTracker.hpp 14.31 14.32 dirtyCardQueue.cpp atomic.hpp 14.33 dirtyCardQueue.cpp dirtyCardQueue.hpp 14.34 @@ -147,7 +143,6 @@ 14.35 g1CollectedHeap.cpp g1OopClosures.inline.hpp 14.36 g1CollectedHeap.cpp genOopClosures.inline.hpp 14.37 g1CollectedHeap.cpp gcLocker.inline.hpp 14.38 -g1CollectedHeap.cpp gcOverheadReporter.hpp 14.39 g1CollectedHeap.cpp generationSpec.hpp 14.40 g1CollectedHeap.cpp heapRegionRemSet.hpp 14.41 g1CollectedHeap.cpp heapRegionSeq.inline.hpp
15.1 --- a/src/share/vm/gc_implementation/includeDB_gc_shared Fri Aug 14 13:44:15 2009 -0700 15.2 +++ b/src/share/vm/gc_implementation/includeDB_gc_shared Wed Aug 19 12:53:25 2009 -0400 15.3 @@ -35,12 +35,6 @@ 15.4 15.5 concurrentGCThread.hpp thread.hpp 15.6 15.7 -coTracker.hpp globalDefinitions.hpp 15.8 -coTracker.hpp numberSeq.hpp 15.9 - 15.10 -coTracker.cpp coTracker.hpp 15.11 -coTracker.cpp os.hpp 15.12 - 15.13 allocationStats.cpp allocationStats.hpp 15.14 allocationStats.cpp ostream.hpp 15.15 15.16 @@ -54,13 +48,6 @@ 15.17 gcAdaptivePolicyCounters.cpp resourceArea.hpp 15.18 gcAdaptivePolicyCounters.cpp gcAdaptivePolicyCounters.hpp 15.19 15.20 -gcOverheadReporter.cpp allocation.inline.hpp 15.21 -gcOverheadReporter.cpp concurrentGCThread.hpp 15.22 -gcOverheadReporter.cpp coTracker.hpp 15.23 -gcOverheadReporter.cpp gcOverheadReporter.hpp 15.24 -gcOverheadReporter.cpp ostream.hpp 15.25 -gcOverheadReporter.cpp thread_<os_family>.inline.hpp 15.26 - 15.27 gSpaceCounters.cpp generation.hpp 15.28 gSpaceCounters.cpp resourceArea.hpp 15.29 gSpaceCounters.cpp gSpaceCounters.hpp
16.1 --- a/src/share/vm/gc_implementation/shared/coTracker.cpp Fri Aug 14 13:44:15 2009 -0700 16.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 16.3 @@ -1,189 +0,0 @@ 16.4 -/* 16.5 - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. 16.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 16.7 - * 16.8 - * This code is free software; you can redistribute it and/or modify it 16.9 - * under the terms of the GNU General Public License version 2 only, as 16.10 - * published by the Free Software Foundation. 16.11 - * 16.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 16.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 16.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 16.15 - * version 2 for more details (a copy is included in the LICENSE file that 16.16 - * accompanied this code). 16.17 - * 16.18 - * You should have received a copy of the GNU General Public License version 16.19 - * 2 along with this work; if not, write to the Free Software Foundation, 16.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 16.21 - * 16.22 - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 16.23 - * CA 95054 USA or visit www.sun.com if you need additional information or 16.24 - * have any questions. 16.25 - * 16.26 - */ 16.27 - 16.28 -# include "incls/_precompiled.incl" 16.29 -# include "incls/_coTracker.cpp.incl" 16.30 - 16.31 -COTracker* COTracker::_head = NULL; 16.32 -double COTracker::_cpu_number = -1.0; 16.33 - 16.34 -void 16.35 -COTracker::resetPeriod(double now_sec, double vnow_sec) { 16.36 - guarantee( _enabled, "invariant" ); 16.37 - _period_start_time_sec = now_sec; 16.38 - _period_start_vtime_sec = vnow_sec; 16.39 -} 16.40 - 16.41 -void 16.42 -COTracker::setConcOverhead(double time_stamp_sec, 16.43 - double conc_overhead) { 16.44 - guarantee( _enabled, "invariant" ); 16.45 - _conc_overhead = conc_overhead; 16.46 - _time_stamp_sec = time_stamp_sec; 16.47 - if (conc_overhead > 0.001) 16.48 - _conc_overhead_seq.add(conc_overhead); 16.49 -} 16.50 - 16.51 -void 16.52 -COTracker::reset(double starting_conc_overhead) { 16.53 - guarantee( _enabled, "invariant" ); 16.54 - double now_sec = os::elapsedTime(); 16.55 - setConcOverhead(now_sec, starting_conc_overhead); 16.56 -} 16.57 - 16.58 -void 16.59 -COTracker::start() { 16.60 - guarantee( _enabled, "invariant" ); 16.61 - resetPeriod(os::elapsedTime(), os::elapsedVTime()); 16.62 -} 16.63 - 16.64 -void 16.65 -COTracker::update(bool force_end) { 16.66 - assert( _enabled, "invariant" ); 16.67 - double end_time_sec = os::elapsedTime(); 16.68 - double elapsed_time_sec = end_time_sec - _period_start_time_sec; 16.69 - if (force_end || elapsed_time_sec > _update_period_sec) { 16.70 - // reached the end of the period 16.71 - double end_vtime_sec = os::elapsedVTime(); 16.72 - double elapsed_vtime_sec = end_vtime_sec - _period_start_vtime_sec; 16.73 - 16.74 - double conc_overhead = elapsed_vtime_sec / elapsed_time_sec; 16.75 - 16.76 - setConcOverhead(end_time_sec, conc_overhead); 16.77 - resetPeriod(end_time_sec, end_vtime_sec); 16.78 - } 16.79 -} 16.80 - 16.81 -void 16.82 -COTracker::updateForSTW(double start_sec, double end_sec) { 16.83 - if (!_enabled) 16.84 - return; 16.85 - 16.86 - // During a STW pause, no concurrent GC thread has done any 16.87 - // work. So, we can safely adjust the start of the current period by 16.88 - // adding the duration of the STW pause to it, so that the STW pause 16.89 - // doesn't affect the reading of the concurrent overhead (it's 16.90 - // basically like excluding the time of the STW pause from the 16.91 - // concurrent overhead calculation). 16.92 - 16.93 - double stw_duration_sec = end_sec - start_sec; 16.94 - guarantee( stw_duration_sec > 0.0, "invariant" ); 16.95 - 16.96 - if (outOfDate(start_sec)) 16.97 - _conc_overhead = 0.0; 16.98 - else 16.99 - _time_stamp_sec = end_sec; 16.100 - _period_start_time_sec += stw_duration_sec; 16.101 - _conc_overhead_seq = NumberSeq(); 16.102 - 16.103 - guarantee( os::elapsedTime() > _period_start_time_sec, "invariant" ); 16.104 -} 16.105 - 16.106 -double 16.107 -COTracker::predConcOverhead() { 16.108 - if (_enabled) { 16.109 - // tty->print(" %1.2lf", _conc_overhead_seq.maximum()); 16.110 - return _conc_overhead_seq.maximum(); 16.111 - } else { 16.112 - // tty->print(" DD"); 16.113 - return 0.0; 16.114 - } 16.115 -} 16.116 - 16.117 -void 16.118 -COTracker::resetPred() { 16.119 - _conc_overhead_seq = NumberSeq(); 16.120 -} 16.121 - 16.122 -COTracker::COTracker(int group) 16.123 - : _enabled(false), 16.124 - _group(group), 16.125 - _period_start_time_sec(-1.0), 16.126 - _period_start_vtime_sec(-1.0), 16.127 - _conc_overhead(-1.0), 16.128 - _time_stamp_sec(-1.0), 16.129 - _next(NULL) { 16.130 - // GCOverheadReportingPeriodMS indicates how frequently the 16.131 - // concurrent overhead will be recorded by the GC Overhead 16.132 - // Reporter. We want to take readings less often than that. If we 16.133 - // took readings more often than some of them might be lost. 16.134 - _update_period_sec = ((double) GCOverheadReportingPeriodMS) / 1000.0 * 1.25; 16.135 - _next = _head; 16.136 - _head = this; 16.137 - 16.138 - if (_cpu_number < 0.0) 16.139 - _cpu_number = (double) os::processor_count(); 16.140 -} 16.141 - 16.142 -// statics 16.143 - 16.144 -void 16.145 -COTracker::updateAllForSTW(double start_sec, double end_sec) { 16.146 - for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { 16.147 - curr->updateForSTW(start_sec, end_sec); 16.148 - } 16.149 -} 16.150 - 16.151 -double 16.152 -COTracker::totalConcOverhead(double now_sec) { 16.153 - double total_conc_overhead = 0.0; 16.154 - 16.155 - for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { 16.156 - double conc_overhead = curr->concOverhead(now_sec); 16.157 - total_conc_overhead += conc_overhead; 16.158 - } 16.159 - 16.160 - return total_conc_overhead; 16.161 -} 16.162 - 16.163 -double 16.164 -COTracker::totalConcOverhead(double now_sec, 16.165 - size_t group_num, 16.166 - double* co_per_group) { 16.167 - double total_conc_overhead = 0.0; 16.168 - 16.169 - for (size_t i = 0; i < group_num; ++i) 16.170 - co_per_group[i] = 0.0; 16.171 - 16.172 - for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { 16.173 - size_t group = curr->_group; 16.174 - assert( 0 <= group && group < group_num, "invariant" ); 16.175 - double conc_overhead = curr->concOverhead(now_sec); 16.176 - 16.177 - co_per_group[group] += conc_overhead; 16.178 - total_conc_overhead += conc_overhead; 16.179 - } 16.180 - 16.181 - return total_conc_overhead; 16.182 -} 16.183 - 16.184 -double 16.185 -COTracker::totalPredConcOverhead() { 16.186 - double total_pred_conc_overhead = 0.0; 16.187 - for (COTracker* curr = _head; curr != NULL; curr = curr->_next) { 16.188 - total_pred_conc_overhead += curr->predConcOverhead(); 16.189 - curr->resetPred(); 16.190 - } 16.191 - return total_pred_conc_overhead / _cpu_number; 16.192 -}
17.1 --- a/src/share/vm/gc_implementation/shared/coTracker.hpp Fri Aug 14 13:44:15 2009 -0700 17.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 17.3 @@ -1,181 +0,0 @@ 17.4 -/* 17.5 - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. 17.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 17.7 - * 17.8 - * This code is free software; you can redistribute it and/or modify it 17.9 - * under the terms of the GNU General Public License version 2 only, as 17.10 - * published by the Free Software Foundation. 17.11 - * 17.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 17.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 17.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 17.15 - * version 2 for more details (a copy is included in the LICENSE file that 17.16 - * accompanied this code). 17.17 - * 17.18 - * You should have received a copy of the GNU General Public License version 17.19 - * 2 along with this work; if not, write to the Free Software Foundation, 17.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 17.21 - * 17.22 - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 17.23 - * CA 95054 USA or visit www.sun.com if you need additional information or 17.24 - * have any questions. 17.25 - * 17.26 - */ 17.27 - 17.28 -// COTracker keeps track of the concurrent overhead of a GC thread. 17.29 - 17.30 -// A thread that needs to be tracked must, itself, start up its 17.31 -// tracker with the start() method and then call the update() method 17.32 -// at regular intervals. What the tracker does is to calculate the 17.33 -// concurrent overhead of a process at a given update period. The 17.34 -// tracker starts and when is detects that it has exceeded the given 17.35 -// period, it calculates the duration of the period in wall-clock time 17.36 -// and the duration of the period in vtime (i.e. how much time the 17.37 -// concurrent processes really took up during this period). The ratio 17.38 -// of the latter over the former is the concurrent overhead of that 17.39 -// process for that period over a single CPU. This overhead is stored 17.40 -// on the tracker, "timestamped" with the wall-clock time of the end 17.41 -// of the period. When the concurrent overhead of this process needs 17.42 -// to be queried, this last "reading" provides a good approximation 17.43 -// (we assume that the concurrent overhead of a particular thread 17.44 -// stays largely constant over time). The timestamp is necessary to 17.45 -// detect when the process has stopped working and the recorded 17.46 -// reading hasn't been updated for some time. 17.47 - 17.48 -// Each concurrent GC thread is considered to be part of a "group" 17.49 -// (i.e. any available concurrent marking threads are part of the 17.50 -// "concurrent marking thread group"). A COTracker is associated with 17.51 -// a single group at construction-time. It's up to each collector to 17.52 -// decide how groups will be mapped to such an id (ids should start 17.53 -// from 0 and be consecutive; there's a hardcoded max group num 17.54 -// defined on the GCOverheadTracker class). The notion of a group has 17.55 -// been introduced to be able to identify how much overhead was 17.56 -// imposed by each group, instead of getting a single value that 17.57 -// covers all concurrent overhead. 17.58 - 17.59 -class COTracker { 17.60 -private: 17.61 - // It indicates whether this tracker is enabled or not. When the 17.62 - // tracker is disabled, then it returns 0.0 as the latest concurrent 17.63 - // overhead and several methods (reset, start, and update) are not 17.64 - // supposed to be called on it. This enabling / disabling facility 17.65 - // is really provided to make a bit more explicit in the code when a 17.66 - // particulary tracker of a processes that doesn't run all the time 17.67 - // (e.g. concurrent marking) is supposed to be used and not it's not. 17.68 - bool _enabled; 17.69 - 17.70 - // The ID of the group associated with this tracker. 17.71 - int _group; 17.72 - 17.73 - // The update period of the tracker. A new value for the concurrent 17.74 - // overhead of the associated process will be made at intervals no 17.75 - // smaller than this. 17.76 - double _update_period_sec; 17.77 - 17.78 - // The start times (both wall-block time and vtime) of the current 17.79 - // interval. 17.80 - double _period_start_time_sec; 17.81 - double _period_start_vtime_sec; 17.82 - 17.83 - // Number seq of the concurrent overhead readings within a period 17.84 - NumberSeq _conc_overhead_seq; 17.85 - 17.86 - // The latest reading of the concurrent overhead (over a single CPU) 17.87 - // imposed by the associated concurrent thread, made available at 17.88 - // the indicated wall-clock time. 17.89 - double _conc_overhead; 17.90 - double _time_stamp_sec; 17.91 - 17.92 - // The number of CPUs that the host machine has (for convenience 17.93 - // really, as we'd have to keep translating it into a double) 17.94 - static double _cpu_number; 17.95 - 17.96 - // Fields that keep a list of all trackers created. This is useful, 17.97 - // since it allows us to sum up the concurrent overhead without 17.98 - // having to write code for a specific collector to broadcast a 17.99 - // request to all its concurrent processes. 17.100 - COTracker* _next; 17.101 - static COTracker* _head; 17.102 - 17.103 - // It indicates that a new period is starting by updating the 17.104 - // _period_start_time_sec and _period_start_vtime_sec fields. 17.105 - void resetPeriod(double now_sec, double vnow_sec); 17.106 - // It updates the latest concurrent overhead reading, taken at a 17.107 - // given wall-clock time. 17.108 - void setConcOverhead(double time_stamp_sec, double conc_overhead); 17.109 - 17.110 - // It determines whether the time stamp of the latest concurrent 17.111 - // overhead reading is out of date or not. 17.112 - bool outOfDate(double now_sec) { 17.113 - // The latest reading is considered out of date, if it was taken 17.114 - // 1.2x the update period. 17.115 - return (now_sec - _time_stamp_sec) > 1.2 * _update_period_sec; 17.116 - } 17.117 - 17.118 -public: 17.119 - // The constructor which associates the tracker with a group ID. 17.120 - COTracker(int group); 17.121 - 17.122 - // Methods to enable / disable the tracker and query whether it is enabled. 17.123 - void enable() { _enabled = true; } 17.124 - void disable() { _enabled = false; } 17.125 - bool enabled() { return _enabled; } 17.126 - 17.127 - // It resets the tracker and sets concurrent overhead reading to be 17.128 - // the given parameter and the associated time stamp to be now. 17.129 - void reset(double starting_conc_overhead = 0.0); 17.130 - // The tracker starts tracking. IT should only be called from the 17.131 - // concurrent thread that is tracked by this tracker. 17.132 - void start(); 17.133 - // It updates the tracker and, if the current period is longer than 17.134 - // the update period, the concurrent overhead reading will be 17.135 - // updated. force_end being true indicates that it's the last call 17.136 - // to update() by this process before the tracker is disabled (the 17.137 - // tracker can be re-enabled later if necessary). It should only be 17.138 - // called from the concurrent thread that is tracked by this tracker 17.139 - // and while the thread has joined the STS. 17.140 - void update(bool force_end = false); 17.141 - // It adjusts the contents of the tracker to take into account a STW 17.142 - // pause. 17.143 - void updateForSTW(double start_sec, double end_sec); 17.144 - 17.145 - // It returns the last concurrent overhead reading over a single 17.146 - // CPU. If the reading is out of date, or the tracker is disabled, 17.147 - // it returns 0.0. 17.148 - double concCPUOverhead(double now_sec) { 17.149 - if (!_enabled || outOfDate(now_sec)) 17.150 - return 0.0; 17.151 - else 17.152 - return _conc_overhead; 17.153 - } 17.154 - 17.155 - // It returns the last concurrent overhead reading over all CPUs 17.156 - // that the host machine has. If the reading is out of date, or the 17.157 - // tracker is disabled, it returns 0.0. 17.158 - double concOverhead(double now_sec) { 17.159 - return concCPUOverhead(now_sec) / _cpu_number; 17.160 - } 17.161 - 17.162 - double predConcOverhead(); 17.163 - 17.164 - void resetPred(); 17.165 - 17.166 - // statics 17.167 - 17.168 - // It notifies all trackers about a STW pause. 17.169 - static void updateAllForSTW(double start_sec, double end_sec); 17.170 - 17.171 - // It returns the sum of the concurrent overhead readings of all 17.172 - // available (and enabled) trackers for the given time stamp. The 17.173 - // overhead is over all the CPUs of the host machine. 17.174 - 17.175 - static double totalConcOverhead(double now_sec); 17.176 - // Like the previous method, but it also sums up the overheads per 17.177 - // group number. The length of the co_per_group array must be at 17.178 - // least as large group_num 17.179 - static double totalConcOverhead(double now_sec, 17.180 - size_t group_num, 17.181 - double* co_per_group); 17.182 - 17.183 - static double totalPredConcOverhead(); 17.184 -};
18.1 --- a/src/share/vm/gc_implementation/shared/gcOverheadReporter.cpp Fri Aug 14 13:44:15 2009 -0700 18.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 18.3 @@ -1,179 +0,0 @@ 18.4 -/* 18.5 - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. 18.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 18.7 - * 18.8 - * This code is free software; you can redistribute it and/or modify it 18.9 - * under the terms of the GNU General Public License version 2 only, as 18.10 - * published by the Free Software Foundation. 18.11 - * 18.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 18.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 18.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 18.15 - * version 2 for more details (a copy is included in the LICENSE file that 18.16 - * accompanied this code). 18.17 - * 18.18 - * You should have received a copy of the GNU General Public License version 18.19 - * 2 along with this work; if not, write to the Free Software Foundation, 18.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18.21 - * 18.22 - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 18.23 - * CA 95054 USA or visit www.sun.com if you need additional information or 18.24 - * have any questions. 18.25 - * 18.26 - */ 18.27 - 18.28 -# include "incls/_precompiled.incl" 18.29 -# include "incls/_gcOverheadReporter.cpp.incl" 18.30 - 18.31 -class COReportingThread : public ConcurrentGCThread { 18.32 -private: 18.33 - GCOverheadReporter* _reporter; 18.34 - 18.35 -public: 18.36 - COReportingThread(GCOverheadReporter* reporter) : _reporter(reporter) { 18.37 - guarantee( _reporter != NULL, "precondition" ); 18.38 - create_and_start(); 18.39 - } 18.40 - 18.41 - virtual void run() { 18.42 - initialize_in_thread(); 18.43 - wait_for_universe_init(); 18.44 - 18.45 - int period_ms = GCOverheadReportingPeriodMS; 18.46 - 18.47 - while ( true ) { 18.48 - os::sleep(Thread::current(), period_ms, false); 18.49 - 18.50 - _sts.join(); 18.51 - double now_sec = os::elapsedTime(); 18.52 - _reporter->collect_and_record_conc_overhead(now_sec); 18.53 - _sts.leave(); 18.54 - } 18.55 - 18.56 - terminate(); 18.57 - } 18.58 -}; 18.59 - 18.60 -GCOverheadReporter* GCOverheadReporter::_reporter = NULL; 18.61 - 18.62 -GCOverheadReporter::GCOverheadReporter(size_t group_num, 18.63 - const char* group_names[], 18.64 - size_t length) 18.65 - : _group_num(group_num), _prev_end_sec(0.0) { 18.66 - guarantee( 0 <= group_num && group_num <= MaxGCOverheadGroupNum, 18.67 - "precondition" ); 18.68 - 18.69 - _base = NEW_C_HEAP_ARRAY(GCOverheadReporterEntry, length); 18.70 - _top = _base + length; 18.71 - _curr = _base; 18.72 - 18.73 - for (size_t i = 0; i < group_num; ++i) { 18.74 - guarantee( group_names[i] != NULL, "precondition" ); 18.75 - _group_names[i] = group_names[i]; 18.76 - } 18.77 -} 18.78 - 18.79 -void 18.80 -GCOverheadReporter::add(double start_sec, double end_sec, 18.81 - double* conc_overhead, 18.82 - double stw_overhead) { 18.83 - assert( _curr <= _top, "invariant" ); 18.84 - 18.85 - if (_curr == _top) { 18.86 - guarantee( false, "trace full" ); 18.87 - return; 18.88 - } 18.89 - 18.90 - _curr->_start_sec = start_sec; 18.91 - _curr->_end_sec = end_sec; 18.92 - for (size_t i = 0; i < _group_num; ++i) { 18.93 - _curr->_conc_overhead[i] = 18.94 - (conc_overhead != NULL) ? conc_overhead[i] : 0.0; 18.95 - } 18.96 - _curr->_stw_overhead = stw_overhead; 18.97 - 18.98 - ++_curr; 18.99 -} 18.100 - 18.101 -void 18.102 -GCOverheadReporter::collect_and_record_conc_overhead(double end_sec) { 18.103 - double start_sec = _prev_end_sec; 18.104 - guarantee( end_sec > start_sec, "invariant" ); 18.105 - 18.106 - double conc_overhead[MaxGCOverheadGroupNum]; 18.107 - COTracker::totalConcOverhead(end_sec, _group_num, conc_overhead); 18.108 - add_conc_overhead(start_sec, end_sec, conc_overhead); 18.109 - _prev_end_sec = end_sec; 18.110 -} 18.111 - 18.112 -void 18.113 -GCOverheadReporter::record_stw_start(double start_sec) { 18.114 - guarantee( start_sec > _prev_end_sec, "invariant" ); 18.115 - collect_and_record_conc_overhead(start_sec); 18.116 -} 18.117 - 18.118 -void 18.119 -GCOverheadReporter::record_stw_end(double end_sec) { 18.120 - double start_sec = _prev_end_sec; 18.121 - COTracker::updateAllForSTW(start_sec, end_sec); 18.122 - add_stw_overhead(start_sec, end_sec, 1.0); 18.123 - 18.124 - _prev_end_sec = end_sec; 18.125 -} 18.126 - 18.127 -void 18.128 -GCOverheadReporter::print() const { 18.129 - tty->print_cr(""); 18.130 - tty->print_cr("GC Overhead (%d entries)", _curr - _base); 18.131 - tty->print_cr(""); 18.132 - GCOverheadReporterEntry* curr = _base; 18.133 - while (curr < _curr) { 18.134 - double total = curr->_stw_overhead; 18.135 - for (size_t i = 0; i < _group_num; ++i) 18.136 - total += curr->_conc_overhead[i]; 18.137 - 18.138 - tty->print("OVERHEAD %12.8lf %12.8lf ", 18.139 - curr->_start_sec, curr->_end_sec); 18.140 - 18.141 - for (size_t i = 0; i < _group_num; ++i) 18.142 - tty->print("%s %12.8lf ", _group_names[i], curr->_conc_overhead[i]); 18.143 - 18.144 - tty->print_cr("STW %12.8lf TOT %12.8lf", curr->_stw_overhead, total); 18.145 - ++curr; 18.146 - } 18.147 - tty->print_cr(""); 18.148 -} 18.149 - 18.150 -// statics 18.151 - 18.152 -void 18.153 -GCOverheadReporter::initGCOverheadReporter(size_t group_num, 18.154 - const char* group_names[]) { 18.155 - guarantee( _reporter == NULL, "should only be called once" ); 18.156 - guarantee( 0 <= group_num && group_num <= MaxGCOverheadGroupNum, 18.157 - "precondition" ); 18.158 - guarantee( group_names != NULL, "pre-condition" ); 18.159 - 18.160 - if (GCOverheadReporting) { 18.161 - _reporter = new GCOverheadReporter(group_num, group_names); 18.162 - new COReportingThread(_reporter); 18.163 - } 18.164 -} 18.165 - 18.166 -void 18.167 -GCOverheadReporter::recordSTWStart(double start_sec) { 18.168 - if (_reporter != NULL) 18.169 - _reporter->record_stw_start(start_sec); 18.170 -} 18.171 - 18.172 -void 18.173 -GCOverheadReporter::recordSTWEnd(double end_sec) { 18.174 - if (_reporter != NULL) 18.175 - _reporter->record_stw_end(end_sec); 18.176 -} 18.177 - 18.178 -void 18.179 -GCOverheadReporter::printGCOverhead() { 18.180 - if (_reporter != NULL) 18.181 - _reporter->print(); 18.182 -}
19.1 --- a/src/share/vm/gc_implementation/shared/gcOverheadReporter.hpp Fri Aug 14 13:44:15 2009 -0700 19.2 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 19.3 @@ -1,141 +0,0 @@ 19.4 -/* 19.5 - * Copyright 2001-2007 Sun Microsystems, Inc. All Rights Reserved. 19.6 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 19.7 - * 19.8 - * This code is free software; you can redistribute it and/or modify it 19.9 - * under the terms of the GNU General Public License version 2 only, as 19.10 - * published by the Free Software Foundation. 19.11 - * 19.12 - * This code is distributed in the hope that it will be useful, but WITHOUT 19.13 - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 19.14 - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 19.15 - * version 2 for more details (a copy is included in the LICENSE file that 19.16 - * accompanied this code). 19.17 - * 19.18 - * You should have received a copy of the GNU General Public License version 19.19 - * 2 along with this work; if not, write to the Free Software Foundation, 19.20 - * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 19.21 - * 19.22 - * Please contact Sun Microsystems, Inc., 4150 Network Circle, Santa Clara, 19.23 - * CA 95054 USA or visit www.sun.com if you need additional information or 19.24 - * have any questions. 19.25 - * 19.26 - */ 19.27 - 19.28 -// Keeps track of the GC overhead (both concurrent and STW). It stores 19.29 -// it in a large array and then prints it to tty at the end of the 19.30 -// execution. 19.31 - 19.32 -// See coTracker.hpp for the explanation on what groups are. 19.33 - 19.34 -// Let's set a maximum number of concurrent overhead groups, to 19.35 -// statically allocate any arrays we need and not to have to 19.36 -// malloc/free them. This is just a bit more convenient. 19.37 -enum { 19.38 - MaxGCOverheadGroupNum = 4 19.39 -}; 19.40 - 19.41 -typedef struct { 19.42 - double _start_sec; 19.43 - double _end_sec; 19.44 - 19.45 - double _conc_overhead[MaxGCOverheadGroupNum]; 19.46 - double _stw_overhead; 19.47 -} GCOverheadReporterEntry; 19.48 - 19.49 -class GCOverheadReporter { 19.50 - friend class COReportingThread; 19.51 - 19.52 -private: 19.53 - enum PrivateConstants { 19.54 - DefaultReporterLength = 128 * 1024 19.55 - }; 19.56 - 19.57 - // Reference to the single instance of this class. 19.58 - static GCOverheadReporter* _reporter; 19.59 - 19.60 - // These three references point to the array that contains the GC 19.61 - // overhead entries (_base is the base of the array, _top is the 19.62 - // address passed the last entry of the array, _curr is the next 19.63 - // entry to be used). 19.64 - GCOverheadReporterEntry* _base; 19.65 - GCOverheadReporterEntry* _top; 19.66 - GCOverheadReporterEntry* _curr; 19.67 - 19.68 - // The number of concurrent overhead groups. 19.69 - size_t _group_num; 19.70 - 19.71 - // The wall-clock time of the end of the last recorded period of GC 19.72 - // overhead. 19.73 - double _prev_end_sec; 19.74 - 19.75 - // Names for the concurrent overhead groups. 19.76 - const char* _group_names[MaxGCOverheadGroupNum]; 19.77 - 19.78 - // Add a new entry to the large array. conc_overhead being NULL is 19.79 - // equivalent to an array full of 0.0s. conc_overhead should have a 19.80 - // length of at least _group_num. 19.81 - void add(double start_sec, double end_sec, 19.82 - double* conc_overhead, 19.83 - double stw_overhead); 19.84 - 19.85 - // Add an entry that represents concurrent GC overhead. 19.86 - // conc_overhead must be at least of length _group_num. 19.87 - // conc_overhead being NULL is equivalent to an array full of 0.0s. 19.88 - void add_conc_overhead(double start_sec, double end_sec, 19.89 - double* conc_overhead) { 19.90 - add(start_sec, end_sec, conc_overhead, 0.0); 19.91 - } 19.92 - 19.93 - // Add an entry that represents STW GC overhead. 19.94 - void add_stw_overhead(double start_sec, double end_sec, 19.95 - double stw_overhead) { 19.96 - add(start_sec, end_sec, NULL, stw_overhead); 19.97 - } 19.98 - 19.99 - // It records the start of a STW pause (i.e. it records the 19.100 - // concurrent overhead up to that point) 19.101 - void record_stw_start(double start_sec); 19.102 - 19.103 - // It records the end of a STW pause (i.e. it records the overhead 19.104 - // associated with the pause and adjusts all the trackers to reflect 19.105 - // the pause) 19.106 - void record_stw_end(double end_sec); 19.107 - 19.108 - // It queries all the trackers of their concurrent overhead and 19.109 - // records it. 19.110 - void collect_and_record_conc_overhead(double end_sec); 19.111 - 19.112 - // It prints the contents of the GC overhead array 19.113 - void print() const; 19.114 - 19.115 - 19.116 - // Constructor. The same preconditions for group_num and group_names 19.117 - // from initGCOverheadReporter apply here too. 19.118 - GCOverheadReporter(size_t group_num, 19.119 - const char* group_names[], 19.120 - size_t length = DefaultReporterLength); 19.121 - 19.122 -public: 19.123 - 19.124 - // statics 19.125 - 19.126 - // It initialises the GCOverheadReporter and launches the concurrent 19.127 - // overhead reporting thread. Both actions happen only if the 19.128 - // GCOverheadReporting parameter is set. The length of the 19.129 - // group_names array should be >= group_num and group_num should be 19.130 - // <= MaxGCOverheadGroupNum. Entries group_namnes[0..group_num-1] 19.131 - // should not be NULL. 19.132 - static void initGCOverheadReporter(size_t group_num, 19.133 - const char* group_names[]); 19.134 - 19.135 - // The following three are provided for convenience and they are 19.136 - // wrappers around record_stw_start(start_sec), record_stw_end(end_sec), 19.137 - // and print(). Each of these checks whether GC overhead reporting 19.138 - // is on (i.e. _reporter != NULL) and, if it is, calls the 19.139 - // corresponding method. Saves from repeating this pattern again and 19.140 - // again from the places where they need to be called. 19.141 - static void recordSTWStart(double start_sec); 19.142 - static void recordSTWEnd(double end_sec); 19.143 - static void printGCOverhead(); 19.144 -};