8231996: ZGC: Replace ZStatisticsForceTrace with check if JFR event is enabled
Reviewed-by: eosterlund
This commit is contained in:
parent
2e1040e4c6
commit
cf86d3519c
@ -716,7 +716,7 @@ void ZStatSubPhase::register_start(const Ticks& start) const {
|
||||
}
|
||||
|
||||
void ZStatSubPhase::register_end(const Ticks& start, const Ticks& end) const {
|
||||
ZTracer::tracer()->report_thread_phase(*this, start, end);
|
||||
ZTracer::tracer()->report_thread_phase(name(), start, end);
|
||||
|
||||
const Tickspan duration = end - start;
|
||||
ZStatSample(_sampler, duration.value());
|
||||
@ -736,7 +736,7 @@ void ZStatCriticalPhase::register_start(const Ticks& start) const {
|
||||
}
|
||||
|
||||
void ZStatCriticalPhase::register_end(const Ticks& start, const Ticks& end) const {
|
||||
ZTracer::tracer()->report_thread_phase(*this, start, end);
|
||||
ZTracer::tracer()->report_thread_phase(name(), start, end);
|
||||
|
||||
const Tickspan duration = end - start;
|
||||
ZStatSample(_sampler, duration.value());
|
||||
@ -759,7 +759,7 @@ THREAD_LOCAL uint32_t ZStatTimerDisable::_active = 0;
|
||||
//
|
||||
// Stat sample/inc
|
||||
//
|
||||
void ZStatSample(const ZStatSampler& sampler, uint64_t value, bool trace) {
|
||||
void ZStatSample(const ZStatSampler& sampler, uint64_t value) {
|
||||
ZStatSamplerData* const cpu_data = sampler.get();
|
||||
Atomic::add(1u, &cpu_data->_nsamples);
|
||||
Atomic::add(value, &cpu_data->_sum);
|
||||
@ -782,18 +782,14 @@ void ZStatSample(const ZStatSampler& sampler, uint64_t value, bool trace) {
|
||||
max = prev_max;
|
||||
}
|
||||
|
||||
if (trace) {
|
||||
ZTracer::tracer()->report_stat_sampler(sampler, value);
|
||||
}
|
||||
ZTracer::tracer()->report_stat_sampler(sampler, value);
|
||||
}
|
||||
|
||||
void ZStatInc(const ZStatCounter& counter, uint64_t increment, bool trace) {
|
||||
void ZStatInc(const ZStatCounter& counter, uint64_t increment) {
|
||||
ZStatCounterData* const cpu_data = counter.get();
|
||||
const uint64_t value = Atomic::add(increment, &cpu_data->_counter);
|
||||
|
||||
if (trace) {
|
||||
ZTracer::tracer()->report_stat_counter(counter, increment, value);
|
||||
}
|
||||
ZTracer::tracer()->report_stat_counter(counter, increment, value);
|
||||
}
|
||||
|
||||
void ZStatInc(const ZStatUnsampledCounter& counter, uint64_t increment) {
|
||||
|
@ -315,8 +315,8 @@ public:
|
||||
//
|
||||
// Stat sample/increment
|
||||
//
|
||||
void ZStatSample(const ZStatSampler& sampler, uint64_t value, bool trace = ZStatisticsForceTrace);
|
||||
void ZStatInc(const ZStatCounter& counter, uint64_t increment = 1, bool trace = ZStatisticsForceTrace);
|
||||
void ZStatSample(const ZStatSampler& sampler, uint64_t value);
|
||||
void ZStatInc(const ZStatCounter& counter, uint64_t increment = 1);
|
||||
void ZStatInc(const ZStatUnsampledCounter& counter, uint64_t increment = 1);
|
||||
|
||||
//
|
||||
|
@ -22,18 +22,19 @@
|
||||
*/
|
||||
|
||||
#include "precompiled.hpp"
|
||||
#include "gc/shared/gcId.hpp"
|
||||
#include "gc/z/zStat.hpp"
|
||||
#include "gc/z/zTracer.hpp"
|
||||
#include "gc/shared/gcId.hpp"
|
||||
#include "gc/shared/gcLocker.hpp"
|
||||
#include "jfr/jfrEvents.hpp"
|
||||
#include "runtime/safepoint.hpp"
|
||||
#include "runtime/safepointVerifiers.hpp"
|
||||
#include "utilities/debug.hpp"
|
||||
#include "utilities/macros.hpp"
|
||||
#if INCLUDE_JFR
|
||||
#include "jfr/metadata/jfrSerializer.hpp"
|
||||
#endif
|
||||
|
||||
#if INCLUDE_JFR
|
||||
|
||||
class ZStatisticsCounterTypeConstant : public JfrSerializer {
|
||||
public:
|
||||
virtual void serialize(JfrCheckpointWriter& writer) {
|
||||
@ -66,7 +67,8 @@ static void register_jfr_type_serializers() {
|
||||
true /* permit_cache */,
|
||||
new ZStatisticsSamplerTypeConstant());
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif // INCLUDE_JFR
|
||||
|
||||
ZTracer* ZTracer::_tracer = NULL;
|
||||
|
||||
@ -79,24 +81,24 @@ void ZTracer::initialize() {
|
||||
JFR_ONLY(register_jfr_type_serializers());
|
||||
}
|
||||
|
||||
void ZTracer::send_stat_counter(uint32_t counter_id, uint64_t increment, uint64_t value) {
|
||||
void ZTracer::send_stat_counter(const ZStatCounter& counter, uint64_t increment, uint64_t value) {
|
||||
NoSafepointVerifier nsv;
|
||||
|
||||
EventZStatisticsCounter e;
|
||||
if (e.should_commit()) {
|
||||
e.set_id(counter_id);
|
||||
e.set_id(counter.id());
|
||||
e.set_increment(increment);
|
||||
e.set_value(value);
|
||||
e.commit();
|
||||
}
|
||||
}
|
||||
|
||||
void ZTracer::send_stat_sampler(uint32_t sampler_id, uint64_t value) {
|
||||
void ZTracer::send_stat_sampler(const ZStatSampler& sampler, uint64_t value) {
|
||||
NoSafepointVerifier nsv;
|
||||
|
||||
EventZStatisticsSampler e;
|
||||
if (e.should_commit()) {
|
||||
e.set_id(sampler_id);
|
||||
e.set_id(sampler.id());
|
||||
e.set_value(value);
|
||||
e.commit();
|
||||
}
|
||||
@ -115,7 +117,7 @@ void ZTracer::send_thread_phase(const char* name, const Ticks& start, const Tick
|
||||
}
|
||||
}
|
||||
|
||||
void ZTracer::send_page_alloc(size_t size, size_t used, size_t free, size_t cache, bool nonblocking, bool noreserve) {
|
||||
void ZTracer::send_page_alloc(size_t size, size_t used, size_t free, size_t cache, ZAllocationFlags flags) {
|
||||
NoSafepointVerifier nsv;
|
||||
|
||||
EventZPageAllocation e;
|
||||
@ -124,28 +126,8 @@ void ZTracer::send_page_alloc(size_t size, size_t used, size_t free, size_t cach
|
||||
e.set_usedAfter(used);
|
||||
e.set_freeAfter(free);
|
||||
e.set_inCacheAfter(cache);
|
||||
e.set_nonBlocking(nonblocking);
|
||||
e.set_noReserve(noreserve);
|
||||
e.set_nonBlocking(flags.non_blocking());
|
||||
e.set_noReserve(flags.no_reserve());
|
||||
e.commit();
|
||||
}
|
||||
}
|
||||
|
||||
void ZTracer::report_stat_counter(const ZStatCounter& counter, uint64_t increment, uint64_t value) {
|
||||
send_stat_counter(counter.id(), increment, value);
|
||||
}
|
||||
|
||||
void ZTracer::report_stat_sampler(const ZStatSampler& sampler, uint64_t value) {
|
||||
send_stat_sampler(sampler.id(), value);
|
||||
}
|
||||
|
||||
void ZTracer::report_thread_phase(const ZStatPhase& phase, const Ticks& start, const Ticks& end) {
|
||||
send_thread_phase(phase.name(), start, end);
|
||||
}
|
||||
|
||||
void ZTracer::report_thread_phase(const char* name, const Ticks& start, const Ticks& end) {
|
||||
send_thread_phase(name, start, end);
|
||||
}
|
||||
|
||||
void ZTracer::report_page_alloc(size_t size, size_t used, size_t free, size_t cache, ZAllocationFlags flags) {
|
||||
send_page_alloc(size, used, free, cache, flags.non_blocking(), flags.no_reserve());
|
||||
}
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -37,10 +37,10 @@ private:
|
||||
|
||||
ZTracer();
|
||||
|
||||
void send_stat_counter(uint32_t counter_id, uint64_t increment, uint64_t value);
|
||||
void send_stat_sampler(uint32_t sampler_id, uint64_t value);
|
||||
void send_stat_counter(const ZStatCounter& counter, uint64_t increment, uint64_t value);
|
||||
void send_stat_sampler(const ZStatSampler& sampler, uint64_t value);
|
||||
void send_thread_phase(const char* name, const Ticks& start, const Ticks& end);
|
||||
void send_page_alloc(size_t size, size_t used, size_t free, size_t cache, bool nonblocking, bool noreserve);
|
||||
void send_page_alloc(size_t size, size_t used, size_t free, size_t cache, ZAllocationFlags flags);
|
||||
|
||||
public:
|
||||
static ZTracer* tracer();
|
||||
@ -48,7 +48,6 @@ public:
|
||||
|
||||
void report_stat_counter(const ZStatCounter& counter, uint64_t increment, uint64_t value);
|
||||
void report_stat_sampler(const ZStatSampler& sampler, uint64_t value);
|
||||
void report_thread_phase(const ZStatPhase& phase, const Ticks& start, const Ticks& end);
|
||||
void report_thread_phase(const char* name, const Ticks& start, const Ticks& end);
|
||||
void report_page_alloc(size_t size, size_t used, size_t free, size_t cache, ZAllocationFlags flags);
|
||||
};
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
* This code is free software; you can redistribute it and/or modify it
|
||||
@ -24,12 +24,38 @@
|
||||
#ifndef SHARE_GC_Z_ZTRACER_INLINE_HPP
|
||||
#define SHARE_GC_Z_ZTRACER_INLINE_HPP
|
||||
|
||||
#include "gc/z/zStat.hpp"
|
||||
#include "gc/z/zTracer.hpp"
|
||||
#include "jfr/jfrEvents.hpp"
|
||||
|
||||
inline ZTracer* ZTracer::tracer() {
|
||||
return _tracer;
|
||||
}
|
||||
|
||||
inline void ZTracer::report_stat_counter(const ZStatCounter& counter, uint64_t increment, uint64_t value) {
|
||||
if (EventZStatisticsCounter::is_enabled()) {
|
||||
send_stat_counter(counter, increment, value);
|
||||
}
|
||||
}
|
||||
|
||||
inline void ZTracer::report_stat_sampler(const ZStatSampler& sampler, uint64_t value) {
|
||||
if (EventZStatisticsSampler::is_enabled()) {
|
||||
send_stat_sampler(sampler, value);
|
||||
}
|
||||
}
|
||||
|
||||
inline void ZTracer::report_thread_phase(const char* name, const Ticks& start, const Ticks& end) {
|
||||
if (EventZThreadPhase::is_enabled()) {
|
||||
send_thread_phase(name, start, end);
|
||||
}
|
||||
}
|
||||
|
||||
inline void ZTracer::report_page_alloc(size_t size, size_t used, size_t free, size_t cache, ZAllocationFlags flags) {
|
||||
if (EventZPageAllocation::is_enabled()) {
|
||||
send_page_alloc(size, used, free, cache, flags);
|
||||
}
|
||||
}
|
||||
|
||||
inline ZTraceThreadPhase::ZTraceThreadPhase(const char* name) :
|
||||
_start(Ticks::now()),
|
||||
_name(name) {}
|
||||
|
@ -67,9 +67,6 @@
|
||||
"Time between statistics print outs (in seconds)") \
|
||||
range(1, (uint)-1) \
|
||||
\
|
||||
diagnostic(bool, ZStatisticsForceTrace, false, \
|
||||
"Force tracing of ZStats") \
|
||||
\
|
||||
diagnostic(bool, ZProactive, true, \
|
||||
"Enable proactive GC cycles") \
|
||||
\
|
||||
|
@ -689,13 +689,13 @@
|
||||
</event>
|
||||
|
||||
<event name="jdk.ZStatisticsCounter">
|
||||
<setting name="enabled">true</setting>
|
||||
<setting name="threshold">10 ms</setting>
|
||||
<setting name="enabled">false</setting>
|
||||
<setting name="threshold">0 ms</setting>
|
||||
</event>
|
||||
|
||||
<event name="jdk.ZStatisticsSampler">
|
||||
<setting name="enabled">true</setting>
|
||||
<setting name="threshold">10 ms</setting>
|
||||
<setting name="enabled">false</setting>
|
||||
<setting name="threshold">0 ms</setting>
|
||||
</event>
|
||||
|
||||
|
||||
|
@ -689,13 +689,13 @@
|
||||
</event>
|
||||
|
||||
<event name="jdk.ZStatisticsCounter">
|
||||
<setting name="threshold">10 ms</setting>
|
||||
<setting name="enabled">true</setting>
|
||||
<setting name="threshold">0 ms</setting>
|
||||
<setting name="enabled">false</setting>
|
||||
</event>
|
||||
|
||||
<event name="jdk.ZStatisticsSampler">
|
||||
<setting name="enabled">true</setting>
|
||||
<setting name="threshold">10 ms</setting>
|
||||
<setting name="enabled">false</setting>
|
||||
<setting name="threshold">0 ms</setting>
|
||||
</event>
|
||||
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user