// The rate estimate is in blocks per second. void compute_desired(size_t count, float inter_sweep_current, float inter_sweep_estimate, float intra_sweep_estimate) { // If the latest inter-sweep time is below our granularity // of measurement, we may call in here with // inter_sweep_current == 0. However, even for suitably small // but non-zero inter-sweep durations, we may not trust the accuracy // of accumulated data, since it has not been "integrated" // (read "low-pass-filtered") long enough, and would be // vulnerable to noisy glitches. In such cases, we // ignore the current sample and use currently available // historical estimates. assert(prev_sweep() + split_births() + coal_births() // "Total Production Stock" >= split_deaths() + coal_deaths() + (ssize_t)count, // "Current stock + depletion" "Conservation Principle"); if (inter_sweep_current > _threshold) { ssize_t demand = prev_sweep() - (ssize_t)count + split_births() + coal_births() - split_deaths() - coal_deaths(); assert(demand >= 0, err_msg("Demand (" SSIZE_FORMAT ") should be non-negative for " PTR_FORMAT " (size=" SIZE_FORMAT ")", demand, p2i(this), count)); // Defensive: adjust for imprecision in event counting if (demand < 0) { demand = 0; } float old_rate = _demand_rate_estimate.padded_average(); float rate = ((float)demand)/inter_sweep_current; _demand_rate_estimate.sample(rate); float new_rate = _demand_rate_estimate.padded_average(); ssize_t old_desired = _desired; float delta_ise = (CMSExtrapolateSweep ? intra_sweep_estimate : 0.0); _desired = (ssize_t)(new_rate * (inter_sweep_estimate + delta_ise)); if (PrintFLSStatistics > 1) { gclog_or_tty->print_cr("demand: " SSIZE_FORMAT ", old_rate: %f, current_rate: %f, " "new_rate: %f, old_desired: " SSIZE_FORMAT ", new_desired: " SSIZE_FORMAT, demand, old_rate, rate, new_rate, old_desired, _desired); } } }
void AdaptiveFreeList<FreeChunk>::print_on(outputStream* st, const char* c) const { if (c != NULL) { st->print("%16s", c); } else { st->print(SIZE_FORMAT_W(16), size()); } st->print("\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\t" SSIZE_FORMAT_W(14) "\n", bfr_surp(), surplus(), desired(), prev_sweep(), before_sweep(), count(), coal_births(), coal_deaths(), split_births(), split_deaths()); }