< prev index next >

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

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


2516   default:                            ShouldNotReachHere();
2517   }
2518   return false; // keep some compilers happy
2519 }
2520 
2521 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2522                                        const VerifyOption vo) const {
2523   switch (vo) {
2524   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
2525   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
2526   case VerifyOption_G1UseMarkWord: {
2527     HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
2528     return !obj->is_gc_marked() && !hr->is_archive();
2529   }
2530   default:                            ShouldNotReachHere();
2531   }
2532   return false; // keep some compilers happy
2533 }
2534 
2535 void G1CollectedHeap::print_heap_regions() const {
2536   Log(gc, heap, region) log;
2537   if (log.is_trace()) {
2538     ResourceMark rm;
2539     print_regions_on(log.trace_stream());
2540   }
2541 }
2542 
2543 void G1CollectedHeap::print_on(outputStream* st) const {
2544   st->print(" %-20s", "garbage-first heap");
2545   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2546             capacity()/K, used_unlocked()/K);
2547   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
2548             p2i(_hrm.reserved().start()),
2549             p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
2550             p2i(_hrm.reserved().end()));
2551   st->cr();
2552   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2553   uint young_regions = young_regions_count();
2554   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2555             (size_t) young_regions * HeapRegion::GrainBytes / K);
2556   uint survivor_regions = survivor_regions_count();
2557   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2558             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2559   st->cr();


2938     }
2939 };
2940 
2941 uint G1CollectedHeap::num_task_queues() const {
2942   return _task_queues->size();
2943 }
2944 
2945 #if TASKQUEUE_STATS
2946 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2947   st->print_raw_cr("GC Task Stats");
2948   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2949   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2950 }
2951 
2952 void G1CollectedHeap::print_taskqueue_stats() const {
2953   if (!log_is_enabled(Trace, gc, task, stats)) {
2954     return;
2955   }
2956   Log(gc, task, stats) log;
2957   ResourceMark rm;
2958   outputStream* st = log.trace_stream();

2959 
2960   print_taskqueue_stats_hdr(st);
2961 
2962   TaskQueueStats totals;
2963   const uint n = num_task_queues();
2964   for (uint i = 0; i < n; ++i) {
2965     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
2966     totals += task_queue(i)->stats;
2967   }
2968   st->print_raw("tot "); totals.print(st); st->cr();
2969 
2970   DEBUG_ONLY(totals.verify());
2971 }
2972 
2973 void G1CollectedHeap::reset_taskqueue_stats() {
2974   const uint n = num_task_queues();
2975   for (uint i = 0; i < n; ++i) {
2976     task_queue(i)->stats.reset();
2977   }
2978 }




2516   default:                            ShouldNotReachHere();
2517   }
2518   return false; // keep some compilers happy
2519 }
2520 
2521 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2522                                        const VerifyOption vo) const {
2523   switch (vo) {
2524   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
2525   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
2526   case VerifyOption_G1UseMarkWord: {
2527     HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
2528     return !obj->is_gc_marked() && !hr->is_archive();
2529   }
2530   default:                            ShouldNotReachHere();
2531   }
2532   return false; // keep some compilers happy
2533 }
2534 
2535 void G1CollectedHeap::print_heap_regions() const {
2536   LogTarget(Trace, gc, heap, region) lt;
2537   if (lt.is_enabled()) {
2538     LogStream ls(lt);
2539     print_regions_on(&ls);
2540   }
2541 }
2542 
2543 void G1CollectedHeap::print_on(outputStream* st) const {
2544   st->print(" %-20s", "garbage-first heap");
2545   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2546             capacity()/K, used_unlocked()/K);
2547   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
2548             p2i(_hrm.reserved().start()),
2549             p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
2550             p2i(_hrm.reserved().end()));
2551   st->cr();
2552   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2553   uint young_regions = young_regions_count();
2554   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2555             (size_t) young_regions * HeapRegion::GrainBytes / K);
2556   uint survivor_regions = survivor_regions_count();
2557   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2558             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2559   st->cr();


2938     }
2939 };
2940 
2941 uint G1CollectedHeap::num_task_queues() const {
2942   return _task_queues->size();
2943 }
2944 
2945 #if TASKQUEUE_STATS
2946 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2947   st->print_raw_cr("GC Task Stats");
2948   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2949   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2950 }
2951 
2952 void G1CollectedHeap::print_taskqueue_stats() const {
2953   if (!log_is_enabled(Trace, gc, task, stats)) {
2954     return;
2955   }
2956   Log(gc, task, stats) log;
2957   ResourceMark rm;
2958   LogStream ls(log.trace());
2959   outputStream* st = &ls;
2960 
2961   print_taskqueue_stats_hdr(st);
2962 
2963   TaskQueueStats totals;
2964   const uint n = num_task_queues();
2965   for (uint i = 0; i < n; ++i) {
2966     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
2967     totals += task_queue(i)->stats;
2968   }
2969   st->print_raw("tot "); totals.print(st); st->cr();
2970 
2971   DEBUG_ONLY(totals.verify());
2972 }
2973 
2974 void G1CollectedHeap::reset_taskqueue_stats() {
2975   const uint n = num_task_queues();
2976   for (uint i = 0; i < n; ++i) {
2977     task_queue(i)->stats.reset();
2978   }
2979 }


< prev index next >