< prev index next >

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

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


2500   default:                            ShouldNotReachHere();
2501   }
2502   return false; // keep some compilers happy
2503 }
2504 
2505 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2506                                        const VerifyOption vo) const {
2507   switch (vo) {
2508   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
2509   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
2510   case VerifyOption_G1UseMarkWord: {
2511     HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
2512     return !obj->is_gc_marked() && !hr->is_archive();
2513   }
2514   default:                            ShouldNotReachHere();
2515   }
2516   return false; // keep some compilers happy
2517 }
2518 
2519 void G1CollectedHeap::print_heap_regions() const {
2520   Log(gc, heap, region) log;
2521   if (log.is_trace()) {
2522     ResourceMark rm;
2523     print_regions_on(log.trace_stream());
2524   }
2525 }
2526 
2527 void G1CollectedHeap::print_on(outputStream* st) const {
2528   st->print(" %-20s", "garbage-first heap");
2529   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2530             capacity()/K, used_unlocked()/K);
2531   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
2532             p2i(_hrm.reserved().start()),
2533             p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
2534             p2i(_hrm.reserved().end()));
2535   st->cr();
2536   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2537   uint young_regions = young_regions_count();
2538   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2539             (size_t) young_regions * HeapRegion::GrainBytes / K);
2540   uint survivor_regions = survivor_regions_count();
2541   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2542             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2543   st->cr();


2922     }
2923 };
2924 
2925 uint G1CollectedHeap::num_task_queues() const {
2926   return _task_queues->size();
2927 }
2928 
2929 #if TASKQUEUE_STATS
2930 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2931   st->print_raw_cr("GC Task Stats");
2932   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2933   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2934 }
2935 
2936 void G1CollectedHeap::print_taskqueue_stats() const {
2937   if (!log_is_enabled(Trace, gc, task, stats)) {
2938     return;
2939   }
2940   Log(gc, task, stats) log;
2941   ResourceMark rm;
2942   outputStream* st = log.trace_stream();

2943 
2944   print_taskqueue_stats_hdr(st);
2945 
2946   TaskQueueStats totals;
2947   const uint n = num_task_queues();
2948   for (uint i = 0; i < n; ++i) {
2949     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
2950     totals += task_queue(i)->stats;
2951   }
2952   st->print_raw("tot "); totals.print(st); st->cr();
2953 
2954   DEBUG_ONLY(totals.verify());
2955 }
2956 
2957 void G1CollectedHeap::reset_taskqueue_stats() {
2958   const uint n = num_task_queues();
2959   for (uint i = 0; i < n; ++i) {
2960     task_queue(i)->stats.reset();
2961   }
2962 }




2500   default:                            ShouldNotReachHere();
2501   }
2502   return false; // keep some compilers happy
2503 }
2504 
2505 bool G1CollectedHeap::is_obj_dead_cond(const oop obj,
2506                                        const VerifyOption vo) const {
2507   switch (vo) {
2508   case VerifyOption_G1UsePrevMarking: return is_obj_dead(obj);
2509   case VerifyOption_G1UseNextMarking: return is_obj_ill(obj);
2510   case VerifyOption_G1UseMarkWord: {
2511     HeapRegion* hr = _hrm.addr_to_region((HeapWord*)obj);
2512     return !obj->is_gc_marked() && !hr->is_archive();
2513   }
2514   default:                            ShouldNotReachHere();
2515   }
2516   return false; // keep some compilers happy
2517 }
2518 
2519 void G1CollectedHeap::print_heap_regions() const {
2520   LogTarget(Trace, gc, heap, region) lt;
2521   if (lt.is_enabled()) {
2522     LogStream ls(lt);
2523     print_regions_on(&ls);
2524   }
2525 }
2526 
2527 void G1CollectedHeap::print_on(outputStream* st) const {
2528   st->print(" %-20s", "garbage-first heap");
2529   st->print(" total " SIZE_FORMAT "K, used " SIZE_FORMAT "K",
2530             capacity()/K, used_unlocked()/K);
2531   st->print(" [" PTR_FORMAT ", " PTR_FORMAT ", " PTR_FORMAT ")",
2532             p2i(_hrm.reserved().start()),
2533             p2i(_hrm.reserved().start() + _hrm.length() + HeapRegion::GrainWords),
2534             p2i(_hrm.reserved().end()));
2535   st->cr();
2536   st->print("  region size " SIZE_FORMAT "K, ", HeapRegion::GrainBytes / K);
2537   uint young_regions = young_regions_count();
2538   st->print("%u young (" SIZE_FORMAT "K), ", young_regions,
2539             (size_t) young_regions * HeapRegion::GrainBytes / K);
2540   uint survivor_regions = survivor_regions_count();
2541   st->print("%u survivors (" SIZE_FORMAT "K)", survivor_regions,
2542             (size_t) survivor_regions * HeapRegion::GrainBytes / K);
2543   st->cr();


2922     }
2923 };
2924 
2925 uint G1CollectedHeap::num_task_queues() const {
2926   return _task_queues->size();
2927 }
2928 
2929 #if TASKQUEUE_STATS
2930 void G1CollectedHeap::print_taskqueue_stats_hdr(outputStream* const st) {
2931   st->print_raw_cr("GC Task Stats");
2932   st->print_raw("thr "); TaskQueueStats::print_header(1, st); st->cr();
2933   st->print_raw("--- "); TaskQueueStats::print_header(2, st); st->cr();
2934 }
2935 
2936 void G1CollectedHeap::print_taskqueue_stats() const {
2937   if (!log_is_enabled(Trace, gc, task, stats)) {
2938     return;
2939   }
2940   Log(gc, task, stats) log;
2941   ResourceMark rm;
2942   LogStream ls(log.trace());
2943   outputStream* st = &ls;
2944 
2945   print_taskqueue_stats_hdr(st);
2946 
2947   TaskQueueStats totals;
2948   const uint n = num_task_queues();
2949   for (uint i = 0; i < n; ++i) {
2950     st->print("%3u ", i); task_queue(i)->stats.print(st); st->cr();
2951     totals += task_queue(i)->stats;
2952   }
2953   st->print_raw("tot "); totals.print(st); st->cr();
2954 
2955   DEBUG_ONLY(totals.verify());
2956 }
2957 
2958 void G1CollectedHeap::reset_taskqueue_stats() {
2959   const uint n = num_task_queues();
2960   for (uint i = 0; i < n; ++i) {
2961     task_queue(i)->stats.reset();
2962   }
2963 }


< prev index next >