Mercurial > hg > truffle
comparison src/share/vm/gc_implementation/parallelScavenge/psPromotionManager.cpp @ 1665:a93a9eda13f7
6962947: shared TaskQueue statistics
Reviewed-by: tonyp, ysr
author | jcoomes |
---|---|
date | Fri, 16 Jul 2010 21:33:21 -0700 |
parents | b2a00dd3117c |
children | 9d7a8ab3736b |
comparison
equal
deleted
inserted
replaced
1657:1a1ce2076047 | 1665:a93a9eda13f7 |
---|---|
88 manager_array(i)->reset(); | 88 manager_array(i)->reset(); |
89 } | 89 } |
90 } | 90 } |
91 | 91 |
92 void PSPromotionManager::post_scavenge() { | 92 void PSPromotionManager::post_scavenge() { |
93 #if PS_PM_STATS | 93 TASKQUEUE_STATS_ONLY(if (PrintGCDetails && ParallelGCVerbose) print_stats()); |
94 print_stats(); | |
95 #endif // PS_PM_STATS | |
96 | |
97 for (uint i = 0; i < ParallelGCThreads + 1; i++) { | 94 for (uint i = 0; i < ParallelGCThreads + 1; i++) { |
98 PSPromotionManager* manager = manager_array(i); | 95 PSPromotionManager* manager = manager_array(i); |
99 if (UseDepthFirstScavengeOrder) { | 96 if (UseDepthFirstScavengeOrder) { |
100 assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); | 97 assert(manager->claimed_stack_depth()->is_empty(), "should be empty"); |
101 } else { | 98 } else { |
103 } | 100 } |
104 manager->flush_labs(); | 101 manager->flush_labs(); |
105 } | 102 } |
106 } | 103 } |
107 | 104 |
108 #if PS_PM_STATS | 105 #if TASKQUEUE_STATS |
109 | |
110 void | 106 void |
111 PSPromotionManager::print_stats(uint i) { | 107 PSPromotionManager::print_taskqueue_stats(uint i) const { |
112 tty->print_cr("---- GC Worker %2d Stats", i); | 108 const TaskQueueStats& stats = depth_first() ? |
113 tty->print_cr(" total pushes %8d", _total_pushes); | 109 _claimed_stack_depth.stats : _claimed_stack_breadth.stats; |
114 tty->print_cr(" masked pushes %8d", _masked_pushes); | 110 tty->print("%3u ", i); |
115 tty->print_cr(" overflow pushes %8d", _overflow_pushes); | 111 stats.print(); |
116 tty->print_cr(" max overflow length %8d", _max_overflow_length); | 112 tty->cr(); |
117 tty->print_cr(""); | 113 } |
118 tty->print_cr(" arrays chunked %8d", _arrays_chunked); | 114 |
119 tty->print_cr(" array chunks processed %8d", _array_chunks_processed); | 115 void |
120 tty->print_cr(""); | 116 PSPromotionManager::print_local_stats(uint i) const { |
121 tty->print_cr(" total steals %8d", _total_steals); | 117 #define FMT " " SIZE_FORMAT_W(10) |
122 tty->print_cr(" masked steals %8d", _masked_steals); | 118 tty->print_cr("%3u" FMT FMT FMT FMT, i, _masked_pushes, _masked_steals, |
123 tty->print_cr(""); | 119 _arrays_chunked, _array_chunks_processed); |
124 } | 120 #undef FMT |
121 } | |
122 | |
123 static const char* const pm_stats_hdr[] = { | |
124 " --------masked------- arrays array", | |
125 "thr push steal chunked chunks", | |
126 "--- ---------- ---------- ---------- ----------" | |
127 }; | |
125 | 128 |
126 void | 129 void |
127 PSPromotionManager::print_stats() { | 130 PSPromotionManager::print_stats() { |
128 tty->print_cr("== GC Tasks Stats (%s), GC %3d", | 131 const bool df = UseDepthFirstScavengeOrder; |
129 (UseDepthFirstScavengeOrder) ? "Depth-First" : "Breadth-First", | 132 tty->print_cr("== GC Task Stats (%s-First), GC %3d", df ? "Depth" : "Breadth", |
130 Universe::heap()->total_collections()); | 133 Universe::heap()->total_collections()); |
131 | 134 |
132 for (uint i = 0; i < ParallelGCThreads+1; ++i) { | 135 tty->print("thr "); TaskQueueStats::print_header(1); tty->cr(); |
133 PSPromotionManager* manager = manager_array(i); | 136 tty->print("--- "); TaskQueueStats::print_header(2); tty->cr(); |
134 manager->print_stats(i); | 137 for (uint i = 0; i < ParallelGCThreads + 1; ++i) { |
135 } | 138 manager_array(i)->print_taskqueue_stats(i); |
136 } | 139 } |
137 | 140 |
138 #endif // PS_PM_STATS | 141 const uint hlines = sizeof(pm_stats_hdr) / sizeof(pm_stats_hdr[0]); |
142 for (uint i = 0; i < hlines; ++i) tty->print_cr(pm_stats_hdr[i]); | |
143 for (uint i = 0; i < ParallelGCThreads + 1; ++i) { | |
144 manager_array(i)->print_local_stats(i); | |
145 } | |
146 } | |
147 | |
148 void | |
149 PSPromotionManager::reset_stats() { | |
150 TaskQueueStats& stats = depth_first() ? | |
151 claimed_stack_depth()->stats : claimed_stack_breadth()->stats; | |
152 stats.reset(); | |
153 _masked_pushes = _masked_steals = 0; | |
154 _arrays_chunked = _array_chunks_processed = 0; | |
155 } | |
156 #endif // TASKQUEUE_STATS | |
139 | 157 |
140 PSPromotionManager::PSPromotionManager() { | 158 PSPromotionManager::PSPromotionManager() { |
141 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); | 159 ParallelScavengeHeap* heap = (ParallelScavengeHeap*)Universe::heap(); |
142 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); | 160 assert(heap->kind() == CollectedHeap::ParallelScavengeHeap, "Sanity"); |
143 _depth_first = UseDepthFirstScavengeOrder; | 161 _depth_first = UseDepthFirstScavengeOrder; |
187 _old_lab.initialize(MemRegion(lab_base, (size_t)0)); | 205 _old_lab.initialize(MemRegion(lab_base, (size_t)0)); |
188 _old_gen_is_full = false; | 206 _old_gen_is_full = false; |
189 | 207 |
190 _prefetch_queue.clear(); | 208 _prefetch_queue.clear(); |
191 | 209 |
192 #if PS_PM_STATS | 210 TASKQUEUE_STATS_ONLY(reset_stats()); |
193 _total_pushes = 0; | |
194 _masked_pushes = 0; | |
195 _overflow_pushes = 0; | |
196 _max_overflow_length = 0; | |
197 _arrays_chunked = 0; | |
198 _array_chunks_processed = 0; | |
199 _total_steals = 0; | |
200 _masked_steals = 0; | |
201 #endif // PS_PM_STATS | |
202 } | 211 } |
203 | 212 |
204 | 213 |
205 void PSPromotionManager::drain_stacks_depth(bool totally_drain) { | 214 void PSPromotionManager::drain_stacks_depth(bool totally_drain) { |
206 assert(depth_first(), "invariant"); | 215 assert(depth_first(), "invariant"); |
421 // So, the is->objArray() test would be very infrequent. | 430 // So, the is->objArray() test would be very infrequent. |
422 if (new_obj_size > _min_array_size_for_chunking && | 431 if (new_obj_size > _min_array_size_for_chunking && |
423 new_obj->is_objArray() && | 432 new_obj->is_objArray() && |
424 PSChunkLargeArrays) { | 433 PSChunkLargeArrays) { |
425 // we'll chunk it | 434 // we'll chunk it |
426 #if PS_PM_STATS | |
427 ++_arrays_chunked; | |
428 #endif // PS_PM_STATS | |
429 oop* const masked_o = mask_chunked_array_oop(o); | 435 oop* const masked_o = mask_chunked_array_oop(o); |
430 push_depth(masked_o); | 436 push_depth(masked_o); |
431 #if PS_PM_STATS | 437 TASKQUEUE_STATS_ONLY(++_arrays_chunked; ++_masked_pushes); |
432 ++_masked_pushes; | |
433 #endif // PS_PM_STATS | |
434 } else { | 438 } else { |
435 // we'll just push its contents | 439 // we'll just push its contents |
436 new_obj->push_contents(this); | 440 new_obj->push_contents(this); |
437 } | 441 } |
438 } else { | 442 } else { |
492 void PSPromotionManager::process_array_chunk(oop old) { | 496 void PSPromotionManager::process_array_chunk(oop old) { |
493 assert(PSChunkLargeArrays, "invariant"); | 497 assert(PSChunkLargeArrays, "invariant"); |
494 assert(old->is_objArray(), "invariant"); | 498 assert(old->is_objArray(), "invariant"); |
495 assert(old->is_forwarded(), "invariant"); | 499 assert(old->is_forwarded(), "invariant"); |
496 | 500 |
497 #if PS_PM_STATS | 501 TASKQUEUE_STATS_ONLY(++_array_chunks_processed); |
498 ++_array_chunks_processed; | |
499 #endif // PS_PM_STATS | |
500 | 502 |
501 oop const obj = old->forwardee(); | 503 oop const obj = old->forwardee(); |
502 | 504 |
503 int start; | 505 int start; |
504 int const end = arrayOop(old)->length(); | 506 int const end = arrayOop(old)->length(); |
506 // we'll chunk more | 508 // we'll chunk more |
507 start = end - _array_chunk_size; | 509 start = end - _array_chunk_size; |
508 assert(start > 0, "invariant"); | 510 assert(start > 0, "invariant"); |
509 arrayOop(old)->set_length(start); | 511 arrayOop(old)->set_length(start); |
510 push_depth(mask_chunked_array_oop(old)); | 512 push_depth(mask_chunked_array_oop(old)); |
511 #if PS_PM_STATS | 513 TASKQUEUE_STATS_ONLY(++_masked_pushes); |
512 ++_masked_pushes; | |
513 #endif // PS_PM_STATS | |
514 } else { | 514 } else { |
515 // this is the final chunk for this array | 515 // this is the final chunk for this array |
516 start = 0; | 516 start = 0; |
517 int const actual_length = arrayOop(obj)->length(); | 517 int const actual_length = arrayOop(obj)->length(); |
518 arrayOop(old)->set_length(actual_length); | 518 arrayOop(old)->set_length(actual_length); |