--- a/src/hotspot/share/gc/z/zServiceability.cpp Thu Aug 09 11:24:30 2018 +0200
+++ b/src/hotspot/share/gc/z/zServiceability.cpp Thu Aug 09 11:24:30 2018 +0200
@@ -30,29 +30,24 @@
#include "memory/metaspaceCounters.hpp"
#include "runtime/perfData.hpp"
-class ZOldGenerationCounters : public GenerationCounters {
+class ZGenerationCounters : public GenerationCounters {
public:
- ZOldGenerationCounters(const char* name, size_t min_capacity, size_t max_capacity) :
- // The "1, 1" parameters are for the n-th generation (=1) with 1 space.
- GenerationCounters(name,
- 1 /* ordinal */,
- 1 /* spaces */,
- min_capacity /* min_capacity */,
- max_capacity /* max_capacity */,
- min_capacity /* curr_capacity */) {}
+ ZGenerationCounters(const char* name, int ordinal, int spaces,
+ size_t min_capacity, size_t max_capacity, size_t curr_capacity) :
+ GenerationCounters(name, ordinal, spaces,
+ min_capacity, max_capacity, curr_capacity) {}
- virtual void update_all() {
- size_t committed = ZHeap::heap()->capacity();
- _current_size->set_value(committed);
+ void update_capacity(size_t capacity) {
+ _current_size->set_value(capacity);
}
};
// Class to expose perf counters used by jstat.
class ZServiceabilityCounters : public CHeapObj<mtGC> {
private:
- ZOldGenerationCounters _old_generation_counters;
- HSpaceCounters _old_space_counters;
- CollectorCounters _collector_counters;
+ ZGenerationCounters _generation_counters;
+ HSpaceCounters _space_counters;
+ CollectorCounters _collector_counters;
public:
ZServiceabilityCounters(size_t min_capacity, size_t max_capacity);
@@ -64,18 +59,21 @@
ZServiceabilityCounters::ZServiceabilityCounters(size_t min_capacity, size_t max_capacity) :
// generation.1
- _old_generation_counters("old",
- min_capacity,
- max_capacity),
+ _generation_counters("old" /* name */,
+ 1 /* ordinal */,
+ 1 /* spaces */,
+ min_capacity /* min_capacity */,
+ max_capacity /* max_capacity */,
+ min_capacity /* curr_capacity */),
// generation.1.space.0
- _old_space_counters(_old_generation_counters.name_space(),
- "space",
- 0 /* ordinal */,
- max_capacity /* max_capacity */,
- min_capacity /* init_capacity */),
+ _space_counters(_generation_counters.name_space(),
+ "space" /* name */,
+ 0 /* ordinal */,
+ max_capacity /* max_capacity */,
+ min_capacity /* init_capacity */),
// gc.collector.2
- _collector_counters("stop-the-world",
- 2 /* ordinal */) {}
+ _collector_counters("stop-the-world" /* name */,
+ 2 /* ordinal */) {}
CollectorCounters* ZServiceabilityCounters::collector_counters() {
return &_collector_counters;
@@ -83,13 +81,12 @@
void ZServiceabilityCounters::update_sizes() {
if (UsePerfData) {
- size_t capacity = ZHeap::heap()->capacity();
- size_t used = MIN2(ZHeap::heap()->used(), capacity);
+ const size_t capacity = ZHeap::heap()->capacity();
+ const size_t used = MIN2(ZHeap::heap()->used(), capacity);
- _old_space_counters.update_capacity(capacity);
- _old_space_counters.update_used(used);
-
- _old_generation_counters.update_all();
+ _generation_counters.update_capacity(capacity);
+ _space_counters.update_capacity(capacity);
+ _space_counters.update_used(used);
MetaspaceCounters::update_performance_counters();
CompressedClassSpaceCounters::update_performance_counters();