8179268: Factor out AdaptiveSizePolicy from top-level interfaces CollectorPolicy and CollectedHeap

Reviewed-by: pliden, sjohanss
This commit is contained in:
Roman Kennke 2017-07-04 20:41:33 +02:00
parent b4d5834c9d
commit 313f3e3ef5
7 changed files with 55 additions and 47 deletions

View file

@ -266,4 +266,33 @@ private:
size_t _metadata_used;
};
// Class that can be used to print information about the
// adaptive size policy at intervals specified by
// AdaptiveSizePolicyOutputInterval. Only print information
// if an adaptive size policy is in use.
class AdaptiveSizePolicyOutput : AllStatic {
static bool enabled() {
return UseParallelGC &&
UseAdaptiveSizePolicy &&
log_is_enabled(Debug, gc, ergo);
}
public:
static void print() {
if (enabled()) {
ParallelScavengeHeap::heap()->size_policy()->print();
}
}
static void print(AdaptiveSizePolicy* size_policy, uint count) {
bool do_print =
enabled() &&
(AdaptiveSizePolicyOutputInterval > 0) &&
(count % AdaptiveSizePolicyOutputInterval) == 0;
if (do_print) {
size_policy->print();
}
}
};
#endif // SHARE_VM_GC_PARALLEL_PARALLELSCAVENGEHEAP_HPP