30 #include "gc/serial/defNewGeneration.inline.hpp"
31 #include "gc/shared/adaptiveSizePolicy.hpp"
32 #include "gc/shared/ageTable.inline.hpp"
33 #include "gc/shared/copyFailedInfo.hpp"
34 #include "gc/shared/gcHeapSummary.hpp"
35 #include "gc/shared/gcTimer.hpp"
36 #include "gc/shared/gcTrace.hpp"
37 #include "gc/shared/gcTraceTime.inline.hpp"
38 #include "gc/shared/genCollectedHeap.hpp"
39 #include "gc/shared/genOopClosures.inline.hpp"
40 #include "gc/shared/generation.hpp"
41 #include "gc/shared/plab.inline.hpp"
42 #include "gc/shared/preservedMarks.inline.hpp"
43 #include "gc/shared/referencePolicy.hpp"
44 #include "gc/shared/space.hpp"
45 #include "gc/shared/spaceDecorator.hpp"
46 #include "gc/shared/strongRootsScope.hpp"
47 #include "gc/shared/taskqueue.inline.hpp"
48 #include "gc/shared/workgroup.hpp"
49 #include "logging/log.hpp"
50 #include "memory/resourceArea.hpp"
51 #include "oops/objArrayOop.hpp"
52 #include "oops/oop.inline.hpp"
53 #include "runtime/atomic.hpp"
54 #include "runtime/handles.hpp"
55 #include "runtime/handles.inline.hpp"
56 #include "runtime/java.hpp"
57 #include "runtime/thread.inline.hpp"
58 #include "utilities/copy.hpp"
59 #include "utilities/globalDefinitions.hpp"
60 #include "utilities/stack.inline.hpp"
61
62 ParScanThreadState::ParScanThreadState(Space* to_space_,
63 ParNewGeneration* young_gen_,
64 Generation* old_gen_,
65 int thread_num_,
66 ObjToScanQueueSet* work_queue_set_,
67 Stack<oop, mtGC>* overflow_stacks_,
68 PreservedMarks* preserved_marks_,
69 size_t desired_plab_sz_,
390 void ParScanThreadStateSet::reset_stats() {
391 for (int i = 0; i < _num_threads; ++i) {
392 thread_state(i).reset_stats();
393 }
394 }
395
396 void ParScanThreadStateSet::print_termination_stats_hdr(outputStream* const st) {
397 st->print_raw_cr("GC Termination Stats");
398 st->print_raw_cr(" elapsed --strong roots-- -------termination-------");
399 st->print_raw_cr("thr ms ms % ms % attempts");
400 st->print_raw_cr("--- --------- --------- ------ --------- ------ --------");
401 }
402
403 void ParScanThreadStateSet::print_termination_stats() {
404 Log(gc, task, stats) log;
405 if (!log.is_debug()) {
406 return;
407 }
408
409 ResourceMark rm;
410 outputStream* st = log.debug_stream();
411
412 print_termination_stats_hdr(st);
413
414 for (int i = 0; i < _num_threads; ++i) {
415 const ParScanThreadState & pss = thread_state(i);
416 const double elapsed_ms = pss.elapsed_time() * 1000.0;
417 const double s_roots_ms = pss.strong_roots_time() * 1000.0;
418 const double term_ms = pss.term_time() * 1000.0;
419 st->print_cr("%3d %9.2f %9.2f %6.2f %9.2f %6.2f " SIZE_FORMAT_W(8),
420 i, elapsed_ms, s_roots_ms, s_roots_ms * 100 / elapsed_ms,
421 term_ms, term_ms * 100 / elapsed_ms, pss.term_attempts());
422 }
423 }
424
425 // Print stats related to work queue activity.
426 void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st) {
427 st->print_raw_cr("GC Task Stats");
428 st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
429 st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
430 }
431
432 void ParScanThreadStateSet::print_taskqueue_stats() {
433 if (!log_develop_is_enabled(Trace, gc, task, stats)) {
434 return;
435 }
436 Log(gc, task, stats) log;
437 ResourceMark rm;
438 outputStream* st = log.trace_stream();
439 print_taskqueue_stats_hdr(st);
440
441 TaskQueueStats totals;
442 for (int i = 0; i < _num_threads; ++i) {
443 const ParScanThreadState & pss = thread_state(i);
444 const TaskQueueStats & stats = pss.taskqueue_stats();
445 st->print("%3d ", i); stats.print(st); st->cr();
446 totals += stats;
447
448 if (pss.overflow_refills() > 0) {
449 st->print_cr(" " SIZE_FORMAT_W(10) " overflow refills "
450 SIZE_FORMAT_W(10) " overflow objects",
451 pss.overflow_refills(), pss.overflow_refill_objs());
452 }
453 }
454 st->print("tot "); totals.print(st); st->cr();
455
456 DEBUG_ONLY(totals.verify());
457 }
458 #endif // TASKQUEUE_STATS
|
30 #include "gc/serial/defNewGeneration.inline.hpp"
31 #include "gc/shared/adaptiveSizePolicy.hpp"
32 #include "gc/shared/ageTable.inline.hpp"
33 #include "gc/shared/copyFailedInfo.hpp"
34 #include "gc/shared/gcHeapSummary.hpp"
35 #include "gc/shared/gcTimer.hpp"
36 #include "gc/shared/gcTrace.hpp"
37 #include "gc/shared/gcTraceTime.inline.hpp"
38 #include "gc/shared/genCollectedHeap.hpp"
39 #include "gc/shared/genOopClosures.inline.hpp"
40 #include "gc/shared/generation.hpp"
41 #include "gc/shared/plab.inline.hpp"
42 #include "gc/shared/preservedMarks.inline.hpp"
43 #include "gc/shared/referencePolicy.hpp"
44 #include "gc/shared/space.hpp"
45 #include "gc/shared/spaceDecorator.hpp"
46 #include "gc/shared/strongRootsScope.hpp"
47 #include "gc/shared/taskqueue.inline.hpp"
48 #include "gc/shared/workgroup.hpp"
49 #include "logging/log.hpp"
50 #include "logging/logStream.hpp"
51 #include "memory/resourceArea.hpp"
52 #include "oops/objArrayOop.hpp"
53 #include "oops/oop.inline.hpp"
54 #include "runtime/atomic.hpp"
55 #include "runtime/handles.hpp"
56 #include "runtime/handles.inline.hpp"
57 #include "runtime/java.hpp"
58 #include "runtime/thread.inline.hpp"
59 #include "utilities/copy.hpp"
60 #include "utilities/globalDefinitions.hpp"
61 #include "utilities/stack.inline.hpp"
62
63 ParScanThreadState::ParScanThreadState(Space* to_space_,
64 ParNewGeneration* young_gen_,
65 Generation* old_gen_,
66 int thread_num_,
67 ObjToScanQueueSet* work_queue_set_,
68 Stack<oop, mtGC>* overflow_stacks_,
69 PreservedMarks* preserved_marks_,
70 size_t desired_plab_sz_,
391 void ParScanThreadStateSet::reset_stats() {
392 for (int i = 0; i < _num_threads; ++i) {
393 thread_state(i).reset_stats();
394 }
395 }
396
397 void ParScanThreadStateSet::print_termination_stats_hdr(outputStream* const st) {
398 st->print_raw_cr("GC Termination Stats");
399 st->print_raw_cr(" elapsed --strong roots-- -------termination-------");
400 st->print_raw_cr("thr ms ms % ms % attempts");
401 st->print_raw_cr("--- --------- --------- ------ --------- ------ --------");
402 }
403
404 void ParScanThreadStateSet::print_termination_stats() {
405 Log(gc, task, stats) log;
406 if (!log.is_debug()) {
407 return;
408 }
409
410 ResourceMark rm;
411 LogStream ls(log.debug());
412 outputStream* st = &ls;
413
414 print_termination_stats_hdr(st);
415
416 for (int i = 0; i < _num_threads; ++i) {
417 const ParScanThreadState & pss = thread_state(i);
418 const double elapsed_ms = pss.elapsed_time() * 1000.0;
419 const double s_roots_ms = pss.strong_roots_time() * 1000.0;
420 const double term_ms = pss.term_time() * 1000.0;
421 st->print_cr("%3d %9.2f %9.2f %6.2f %9.2f %6.2f " SIZE_FORMAT_W(8),
422 i, elapsed_ms, s_roots_ms, s_roots_ms * 100 / elapsed_ms,
423 term_ms, term_ms * 100 / elapsed_ms, pss.term_attempts());
424 }
425 }
426
427 // Print stats related to work queue activity.
428 void ParScanThreadStateSet::print_taskqueue_stats_hdr(outputStream* const st) {
429 st->print_raw_cr("GC Task Stats");
430 st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
431 st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
432 }
433
434 void ParScanThreadStateSet::print_taskqueue_stats() {
435 if (!log_develop_is_enabled(Trace, gc, task, stats)) {
436 return;
437 }
438 Log(gc, task, stats) log;
439 ResourceMark rm;
440 LogStream ls(log.trace());
441 outputStream* st = &ls;
442 print_taskqueue_stats_hdr(st);
443
444 TaskQueueStats totals;
445 for (int i = 0; i < _num_threads; ++i) {
446 const ParScanThreadState & pss = thread_state(i);
447 const TaskQueueStats & stats = pss.taskqueue_stats();
448 st->print("%3d ", i); stats.print(st); st->cr();
449 totals += stats;
450
451 if (pss.overflow_refills() > 0) {
452 st->print_cr(" " SIZE_FORMAT_W(10) " overflow refills "
453 SIZE_FORMAT_W(10) " overflow objects",
454 pss.overflow_refills(), pss.overflow_refill_objs());
455 }
456 }
457 st->print("tot "); totals.print(st); st->cr();
458
459 DEBUG_ONLY(totals.verify());
460 }
461 #endif // TASKQUEUE_STATS
|