8287832: jdk/jfr/event/runtime/TestActiveSettingEvent.java failed with "Expected two batches of Active Setting events"
Reviewed-by: egahlin
This commit is contained in:
parent
35d17a00ab
commit
4df4a1f8e2
@ -277,9 +277,7 @@ JVM_ENTRY_NO_ENV(void, jfr_set_method_sampling_period(JNIEnv* env, jobject jvm,
|
|||||||
}
|
}
|
||||||
JfrEventId typed_event_id = (JfrEventId)type;
|
JfrEventId typed_event_id = (JfrEventId)type;
|
||||||
assert(EventExecutionSample::eventId == typed_event_id || EventNativeMethodSample::eventId == typed_event_id, "invariant");
|
assert(EventExecutionSample::eventId == typed_event_id || EventNativeMethodSample::eventId == typed_event_id, "invariant");
|
||||||
if (periodMillis > 0) {
|
JfrEventSetting::set_enabled(typed_event_id, periodMillis > 0);
|
||||||
JfrEventSetting::set_enabled(typed_event_id, true); // ensure sampling event is enabled
|
|
||||||
}
|
|
||||||
if (EventExecutionSample::eventId == type) {
|
if (EventExecutionSample::eventId == type) {
|
||||||
JfrThreadSampling::set_java_sample_period(periodMillis);
|
JfrThreadSampling::set_java_sample_period(periodMillis);
|
||||||
} else {
|
} else {
|
||||||
|
@ -299,14 +299,18 @@ static const uint MAX_NR_OF_NATIVE_SAMPLES = 1;
|
|||||||
void JfrThreadSampleClosure::commit_events(JfrSampleType type) {
|
void JfrThreadSampleClosure::commit_events(JfrSampleType type) {
|
||||||
if (JAVA_SAMPLE == type) {
|
if (JAVA_SAMPLE == type) {
|
||||||
assert(_added_java > 0 && _added_java <= MAX_NR_OF_JAVA_SAMPLES, "invariant");
|
assert(_added_java > 0 && _added_java <= MAX_NR_OF_JAVA_SAMPLES, "invariant");
|
||||||
for (uint i = 0; i < _added_java; ++i) {
|
if (EventExecutionSample::is_enabled()) {
|
||||||
_events[i].commit();
|
for (uint i = 0; i < _added_java; ++i) {
|
||||||
|
_events[i].commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
assert(NATIVE_SAMPLE == type, "invariant");
|
assert(NATIVE_SAMPLE == type, "invariant");
|
||||||
assert(_added_native > 0 && _added_native <= MAX_NR_OF_NATIVE_SAMPLES, "invariant");
|
assert(_added_native > 0 && _added_native <= MAX_NR_OF_NATIVE_SAMPLES, "invariant");
|
||||||
for (uint i = 0; i < _added_native; ++i) {
|
if (EventNativeMethodSample::is_enabled()) {
|
||||||
_events_native[i].commit();
|
for (uint i = 0; i < _added_native; ++i) {
|
||||||
|
_events_native[i].commit();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -63,24 +63,20 @@ class JfrEvent {
|
|||||||
private:
|
private:
|
||||||
jlong _start_time;
|
jlong _start_time;
|
||||||
jlong _end_time;
|
jlong _end_time;
|
||||||
bool _started;
|
|
||||||
bool _untimed;
|
bool _untimed;
|
||||||
bool _should_commit;
|
bool _should_commit;
|
||||||
bool _evaluated;
|
bool _evaluated;
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
JfrEvent(EventStartTime timing=TIMED) : _start_time(0), _end_time(0),
|
JfrEvent(EventStartTime timing=TIMED) : _start_time(0), _end_time(0),
|
||||||
_started(false), _untimed(timing == UNTIMED),
|
_untimed(timing == UNTIMED),
|
||||||
_should_commit(false), _evaluated(false)
|
_should_commit(false), _evaluated(false)
|
||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
, _verifier()
|
, _verifier()
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
if (T::is_enabled() && JfrThreadLocal::is_included(Thread::current())) {
|
if (!T::isInstant && !_untimed && is_enabled()) {
|
||||||
_started = true;
|
set_starttime(JfrTicks::now());
|
||||||
if (TIMED == timing && !T::isInstant) {
|
|
||||||
set_starttime(JfrTicks::now());
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -146,20 +142,17 @@ class JfrEvent {
|
|||||||
return T::hasStackTrace;
|
return T::hasStackTrace;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool is_started() const {
|
bool is_started() {
|
||||||
return _started;
|
return is_instant() || _start_time != 0 || _untimed;
|
||||||
}
|
}
|
||||||
|
|
||||||
bool should_commit() {
|
bool should_commit() {
|
||||||
if (!_started) {
|
if (!is_enabled()) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (_untimed) {
|
if (_untimed) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
if (_evaluated) {
|
|
||||||
return _should_commit;
|
|
||||||
}
|
|
||||||
_should_commit = evaluate();
|
_should_commit = evaluate();
|
||||||
_evaluated = true;
|
_evaluated = true;
|
||||||
return _should_commit;
|
return _should_commit;
|
||||||
@ -167,11 +160,16 @@ class JfrEvent {
|
|||||||
|
|
||||||
private:
|
private:
|
||||||
bool should_write() {
|
bool should_write() {
|
||||||
return _started && (_evaluated ? _should_commit : evaluate());
|
if (_evaluated) {
|
||||||
|
return _should_commit;
|
||||||
|
}
|
||||||
|
if (!is_enabled()) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return evaluate() && JfrThreadLocal::is_included(Thread::current());
|
||||||
}
|
}
|
||||||
|
|
||||||
bool evaluate() {
|
bool evaluate() {
|
||||||
assert(_started, "invariant");
|
|
||||||
if (_start_time == 0) {
|
if (_start_time == 0) {
|
||||||
set_starttime(JfrTicks::now());
|
set_starttime(JfrTicks::now());
|
||||||
} else if (_end_time == 0) {
|
} else if (_end_time == 0) {
|
||||||
|
@ -749,7 +749,6 @@ jdk/jfr/startupargs/TestStartName.java 8214685 windows-
|
|||||||
jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64
|
jdk/jfr/startupargs/TestStartDuration.java 8214685 windows-x64
|
||||||
jdk/jfr/jvm/TestWaste.java 8282427 generic-all
|
jdk/jfr/jvm/TestWaste.java 8282427 generic-all
|
||||||
jdk/jfr/api/consumer/recordingstream/TestOnEvent.java 8255404 linux-x64
|
jdk/jfr/api/consumer/recordingstream/TestOnEvent.java 8255404 linux-x64
|
||||||
jdk/jfr/event/runtime/TestActiveSettingEvent.java 8287832 generic-all
|
|
||||||
jdk/jfr/api/consumer/TestRecordingFileWrite.java 8287699 linux-x64,macosx-x64
|
jdk/jfr/api/consumer/TestRecordingFileWrite.java 8287699 linux-x64,macosx-x64
|
||||||
|
|
||||||
############################################################################
|
############################################################################
|
||||||
|
Loading…
Reference in New Issue
Block a user