Пример #1
0
bool TenuredGeneration::promotion_attempt_is_safe(
    size_t max_promotion_in_bytes,
    bool younger_handles_promotion_failure) const {

  bool result = max_contiguous_available() >= max_promotion_in_bytes;

  if (younger_handles_promotion_failure && !result) {
    result = max_contiguous_available() >=
      (size_t) gc_stats()->avg_promoted()->padded_average();
    if (PrintGC && Verbose && result) {
      gclog_or_tty->print_cr("TenuredGeneration::promotion_attempt_is_safe"
                  " contiguous_available: " SIZE_FORMAT
                  " avg_promoted: " SIZE_FORMAT,
                  max_contiguous_available(),
                  gc_stats()->avg_promoted()->padded_average());
    }
  } else {
    if (PrintGC && Verbose) {
      gclog_or_tty->print_cr("TenuredGeneration::promotion_attempt_is_safe"
                  " contiguous_available: " SIZE_FORMAT
                  " promotion_in_bytes: " SIZE_FORMAT,
                  max_contiguous_available(), max_promotion_in_bytes);
    }
  }
  return result;
}
Пример #2
0
bool TenuredGeneration::promotion_attempt_is_safe(size_t max_promotion_in_bytes) const {
  size_t available = max_contiguous_available();
  size_t av_promo  = (size_t)gc_stats()->avg_promoted()->padded_average();
  bool   res = (available >= av_promo) || (available >= max_promotion_in_bytes);
  if (PrintGC && Verbose) {
    gclog_or_tty->print_cr(
      "Tenured: promo attempt is%s safe: available("SIZE_FORMAT") %s av_promo("SIZE_FORMAT"),"
      "max_promo("SIZE_FORMAT")",
      res? "":" not", available, res? ">=":"<",
      av_promo, max_promotion_in_bytes);
  }
  return res;
}
Пример #3
0
void TenuredGeneration::update_gc_stats(int current_level,
                                        bool full) {
  // If the next lower level(s) has been collected, gather any statistics
  // that are of interest at this point.
  if (!full && (current_level + 1) == level()) {
    // Calculate size of data promoted from the younger generations
    // before doing the collection.
    size_t used_before_gc = used();

    // If the younger gen collections were skipped, then the
    // number of promoted bytes will be 0 and adding it to the
    // average will incorrectly lessen the average.  It is, however,
    // also possible that no promotion was needed.
    if (used_before_gc >= _used_at_prologue) {
      size_t promoted_in_bytes = used_before_gc - _used_at_prologue;
      gc_stats()->avg_promoted()->sample(promoted_in_bytes);
    }
  }
}