< prev index next >

src/share/vm/gc/g1/g1CollectedHeap.cpp

Print this page
rev 13288 : imported patch 8181917-refactor-ul-logstream


2478   default:                            ShouldNotReachHere();
2479   }
2480   return false; // keep some compilers happy
2481 }
2482 
2483 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2484                                        const VerifyOption vo) const {
2485   switch (vo) {
2486   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
2487   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
2488   case VerifyOption_G1UseMarkWord: {
2489     HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
2490     return !obj->is_gc_marked() && !hr->is_archive();
2491   }
2492   default:                            ShouldNotReachHere();
2493   }
2494   return false; // keep some compilers happy
2495 }
2496 
2497 void G1CollectedHeap::print_heap_regions() const {
2498   Log(gc, heap, region) log;
2499   if (log.is_trace()) {
2500     ResourceMark rm;
2501     print_regions_on(log.trace_stream());
2502   }
2503 }
2504 
2505 void G1CollectedHeap::print_on(outputStream* st) const {
2506   st->print(" %-20s", "garbage-first heap");
2507   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2508             capacity()/K, used_unlocked()/K);
2509   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
2510             p2i(_hrm.reserved().start()),
2511             p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
2512             p2i(_hrm.reserved().end()));
2513   st->cr();
2514   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2515   uint young_regions = young_regions_count();
2516   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2517             (size_t) young_regions * HeapRegion::GrainBytes / K);
2518   uint survivor_regions = survivor_regions_count();
2519   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2520             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2521   st->cr();


2900     }
2901 };
2902 
2903 uint G1CollectedHeap::num_task_queues() const {
2904   return _task_queues->size();
2905 }
2906 
2907 #if TASKQUEUE_STATS
2908 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2909   st->print_raw_cr("GC Task Stats");
2910   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2911   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2912 }
2913 
2914 void G1CollectedHeap::print_taskqueue_stats() const {
2915   if (!log_is_enabled(Trace, gc, task, stats)) {
2916     return;
2917   }
2918   Log(gc, task, stats) log;
2919   ResourceMark rm;
2920   outputStream* st = log.trace_stream();

2921 
2922   print_taskqueue_stats_hdr(st);
2923 
2924   TaskQueueStats totals;
2925   const uint n = num_task_queues();
2926   for (uint i = 0; i < n; ++i) {
2927     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
2928     totals += task_queue(i)->stats;
2929   }
2930   st->print_raw("tot "); totals.print(st); st->cr();
2931 
2932   DEBUG_ONLY(totals.verify());
2933 }
2934 
2935 void G1CollectedHeap::reset_taskqueue_stats() {
2936   const uint n = num_task_queues();
2937   for (uint i = 0; i < n; ++i) {
2938     task_queue(i)->stats.reset();
2939   }
2940 }




2478   default:                            ShouldNotReachHere();
2479   }
2480   return false; // keep some compilers happy
2481 }
2482 
2483 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2484                                        const VerifyOption vo) const {
2485   switch (vo) {
2486   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
2487   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
2488   case VerifyOption_G1UseMarkWord: {
2489     HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
2490     return !obj->is_gc_marked() && !hr->is_archive();
2491   }
2492   default:                            ShouldNotReachHere();
2493   }
2494   return false; // keep some compilers happy
2495 }
2496 
2497 void G1CollectedHeap::print_heap_regions() const {
2498   LogTarget(Trace, gc, heap, region) lt;
2499   if (lt.is_enabled()) {
2500     LogStream ls(lt);
2501     print_regions_on(&ls);
2502   }
2503 }
2504 
2505 void G1CollectedHeap::print_on(outputStream* st) const {
2506   st->print(" %-20s", "garbage-first heap");
2507   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2508             capacity()/K, used_unlocked()/K);
2509   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
2510             p2i(_hrm.reserved().start()),
2511             p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
2512             p2i(_hrm.reserved().end()));
2513   st->cr();
2514   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2515   uint young_regions = young_regions_count();
2516   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2517             (size_t) young_regions * HeapRegion::GrainBytes / K);
2518   uint survivor_regions = survivor_regions_count();
2519   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2520             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2521   st->cr();


2900     }
2901 };
2902 
2903 uint G1CollectedHeap::num_task_queues() const {
2904   return _task_queues->size();
2905 }
2906 
2907 #if TASKQUEUE_STATS
2908 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2909   st->print_raw_cr("GC Task Stats");
2910   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2911   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2912 }
2913 
2914 void G1CollectedHeap::print_taskqueue_stats() const {
2915   if (!log_is_enabled(Trace, gc, task, stats)) {
2916     return;
2917   }
2918   Log(gc, task, stats) log;
2919   ResourceMark rm;
2920   LogStream ls(log.trace());
2921   outputStream* st = &ls;
2922 
2923   print_taskqueue_stats_hdr(st);
2924 
2925   TaskQueueStats totals;
2926   const uint n = num_task_queues();
2927   for (uint i = 0; i < n; ++i) {
2928     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
2929     totals += task_queue(i)->stats;
2930   }
2931   st->print_raw("tot "); totals.print(st); st->cr();
2932 
2933   DEBUG_ONLY(totals.verify());
2934 }
2935 
2936 void G1CollectedHeap::reset_taskqueue_stats() {
2937   const uint n = num_task_queues();
2938   for (uint i = 0; i < n; ++i) {
2939     task_queue(i)->stats.reset();
2940   }
2941 }


< prev index next >