8277397: ZGC: Add JFR event for temporary latency measurements

Reviewed-by: eosterlund, jbachorik, pliden, mgronlun
This commit is contained in:
Stefan Karlsson 2021-11-24 08:25:03 +00:00
parent 7b2d823e84
commit 712b875682
6 changed files with 43 additions and 6 deletions

View File

@ -131,3 +131,16 @@ void ZTracer::send_thread_phase(const char* name, const Ticks& start, const Tick
e.commit();
}
}
void ZTracer::send_thread_debug(const char* name, const Ticks& start, const Ticks& end) {
NoSafepointVerifier nsv;
EventZThreadDebug e(UNTIMED);
if (e.should_commit()) {
e.set_gcId(GCId::current_or_undefined());
e.set_name(name);
e.set_starttime(start);
e.set_endtime(end);
e.commit();
}
}

View File

@ -39,6 +39,7 @@ private:
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_thread_debug(const char* name, const Ticks& start, const Ticks& end);
public:
static ZTracer* tracer();
@ -47,16 +48,18 @@ 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 char* name, const Ticks& start, const Ticks& end);
void report_thread_debug(const char* name, const Ticks& start, const Ticks& end);
};
class ZTraceThreadPhase : public StackObj {
// For temporary latency measurements during development and debugging
class ZTraceThreadDebug : public StackObj {
private:
const Ticks _start;
const char* const _name;
public:
ZTraceThreadPhase(const char* name);
~ZTraceThreadPhase();
ZTraceThreadDebug(const char* name);
~ZTraceThreadDebug();
};
#endif // SHARE_GC_Z_ZTRACER_HPP

View File

@ -50,12 +50,18 @@ inline void ZTracer::report_thread_phase(const char* name, const Ticks& start, c
}
}
inline ZTraceThreadPhase::ZTraceThreadPhase(const char* name) :
inline void ZTracer::report_thread_debug(const char* name, const Ticks& start, const Ticks& end) {
if (EventZThreadDebug::is_enabled()) {
send_thread_debug(name, start, end);
}
}
inline ZTraceThreadDebug::ZTraceThreadDebug(const char* name) :
_start(Ticks::now()),
_name(name) {}
inline ZTraceThreadPhase::~ZTraceThreadPhase() {
ZTracer::tracer()->report_thread_phase(_name, _start, Ticks::now());
inline ZTraceThreadDebug::~ZTraceThreadDebug() {
ZTracer::tracer()->report_thread_debug(_name, _start, Ticks::now());
}
#endif // SHARE_GC_Z_ZTRACER_INLINE_HPP

View File

@ -1034,6 +1034,11 @@
<Field type="string" name="name" label="Name" />
</Event>
<Event name="ZThreadDebug" category="Java Virtual Machine, GC, Detailed" label="ZGC Thread Event" description="Temporary latency measurements used during development and debugging of ZGC" thread="true" experimental="true">
<Field type="uint" name="gcId" label="GC Identifier" relation="GcId"/>
<Field type="string" name="name" label="Name" />
</Event>
<Event name="ZUncommit" category="Java Virtual Machine, GC, Detailed" label="ZGC Uncommit" description="Uncommitting of memory" thread="true">
<Field type="ulong" contentType="bytes" name="uncommitted" label="Uncommitted" />
</Event>

View File

@ -775,6 +775,11 @@
<setting name="threshold">0 ms</setting>
</event>
<event name="jdk.ZThreadDebug">
<setting name="enabled">true</setting>
<setting name="threshold">0 ms</setting>
</event>
<event name="jdk.ZUncommit">
<setting name="enabled">true</setting>
<setting name="threshold">0 ms</setting>

View File

@ -775,6 +775,11 @@
<setting name="threshold">0 ms</setting>
</event>
<event name="jdk.ZThreadDebug">
<setting name="enabled">true</setting>
<setting name="threshold">0 ms</setting>
</event>
<event name="jdk.ZUncommit">
<setting name="enabled">true</setting>
<setting name="threshold">0 ms</setting>