mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-14 20:35:09 +00:00
8209125: ZGC: Clean up ZServiceabilityCounters
Reviewed-by: eosterlund, tschatzl
This commit is contained in:
parent
e05a66c789
commit
6c7f0f0218
@ -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 @@ public:
|
||||
|
||||
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 @@ CollectorCounters* ZServiceabilityCounters::collector_counters() {
|
||||
|
||||
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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user