Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

8277397: ZGC: Add JFR event for temporary latency measurements #6454

Closed
wants to merge 3 commits into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
@@ -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();
}
}
@@ -39,6 +39,7 @@ class ZTracer : public GCTracer {
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 @@ class ZTracer : public GCTracer {
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
@@ -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
@@ -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>
@@ -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>
@@ -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>