< prev index next >

src/hotspot/share/gc/shared/ageTable.cpp

Print this page
*** 31,19 ***
  #include "memory/resourceArea.hpp"
  #include "runtime/perfData.hpp"
  #include "logging/log.hpp"
  #include "oops/oop.inline.hpp"
  #include "utilities/copy.hpp"
  
  /* Copyright (c) 1992, 2021, Oracle and/or its affiliates, and Stanford University.
     See the LICENSE file for license information. */
  
! AgeTable::AgeTable(bool global) {
  
    clear();
  
!   if (UsePerfData && global) {
  
      ResourceMark rm;
      EXCEPTION_MARK;
  
      const char* agetable_ns = "generation.0.agetable";
--- 31,20 ---
  #include "memory/resourceArea.hpp"
  #include "runtime/perfData.hpp"
  #include "logging/log.hpp"
  #include "oops/oop.inline.hpp"
  #include "utilities/copy.hpp"
+ #include "logging/logStream.hpp"
  
  /* Copyright (c) 1992, 2021, Oracle and/or its affiliates, and Stanford University.
     See the LICENSE file for license information. */
  
! AgeTable::AgeTable(bool global) : _use_perf_data(UsePerfData && global) {
  
    clear();
  
!   if (_use_perf_data) {
  
      ResourceMark rm;
      EXCEPTION_MARK;
  
      const char* agetable_ns = "generation.0.agetable";

*** 68,11 ***
    for (size_t* p = sizes; p < sizes + table_size; ++p) {
      *p = 0;
    }
  }
  
! void AgeTable::merge(AgeTable* subTable) {
    for (int i = 0; i < table_size; i++) {
      sizes[i]+= subTable->sizes[i];
    }
  }
  
--- 69,11 ---
    for (size_t* p = sizes; p < sizes + table_size; ++p) {
      *p = 0;
    }
  }
  
! void AgeTable::merge(const AgeTable* subTable) {
    for (int i = 0; i < table_size; i++) {
      sizes[i]+= subTable->sizes[i];
    }
  }
  

*** 103,27 ***
  
    return result;
  }
  
  void AgeTable::print_age_table(uint tenuring_threshold) {
!   if (log_is_enabled(Trace, gc, age) || UsePerfData || AgeTableTracer::is_tenuring_distribution_event_enabled()) {
!     log_trace(gc, age)("Age table with threshold %u (max threshold " UINTX_FORMAT ")",
!                        tenuring_threshold, MaxTenuringThreshold);
! 
-     size_t total = 0;
-     uint age = 1;
-     while (age < table_size) {
-       size_t wordSize = sizes[age];
-       total += wordSize;
-       if (wordSize > 0) {
-         log_trace(gc, age)("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
-                             age, wordSize * oopSize, total * oopSize);
-       }
-       AgeTableTracer::send_tenuring_distribution_event(age, wordSize * oopSize);
-       if (UsePerfData) {
-         _perf_sizes[age]->set_value(wordSize * oopSize);
-       }
-       age++;
-     }
    }
  }
  
--- 104,32 ---
  
    return result;
  }
  
  void AgeTable::print_age_table(uint tenuring_threshold) {
!   LogTarget(Trace, gc, age) lt;
!   if (lt.is_enabled() || _use_perf_data || AgeTableTracer::is_tenuring_distribution_event_enabled()) {
!     LogStream st(lt);
!     print_on(&st, tenuring_threshold);
    }
  }
  
+ void AgeTable::print_on(outputStream* st, uint tenuring_threshold) {
+   st->print_cr("Age table with threshold %u (max threshold " UINTX_FORMAT ")",
+            tenuring_threshold, MaxTenuringThreshold);
+ 
+   size_t total = 0;
+   uint age = 1;
+   while (age < table_size) {
+     size_t word_size = sizes[age];
+     total += word_size;
+     if (word_size > 0) {
+       st->print_cr("- age %3u: " SIZE_FORMAT_W(10) " bytes, " SIZE_FORMAT_W(10) " total",
+                    age, word_size * oopSize, total * oopSize);
+     }
+     AgeTableTracer::send_tenuring_distribution_event(age, word_size * oopSize);
+     if (_use_perf_data) {
+       _perf_sizes[age]->set_value(word_size * oopSize);
+     }
+     age++;
+   }
+ }
< prev index next >