< prev index next >
src/share/vm/jfr/support/jfrFlush.hpp
Print this page
rev 9055 : 8214542: JFR: Old Object Sample event slow on a deep heap in debug builds
Reviewed-by: egahlin, rwestberg
@@ -46,14 +46,16 @@
bool jfr_save_stacktrace(Thread* t);
void jfr_clear_stacktrace(Thread* t);
template <typename Event>
class JfrConditionalFlush {
+ protected:
+ bool _enabled;
public:
typedef JfrBuffer Type;
- JfrConditionalFlush(Thread* t) {
- if (jfr_is_event_enabled(Event::eventId)) {
+ JfrConditionalFlush(Thread* t) : _enabled(jfr_is_event_enabled(Event::eventId)) {
+ if (_enabled) {
jfr_conditional_flush(Event::eventId, sizeof(Event), t);
}
}
};
@@ -61,11 +63,11 @@
class JfrConditionalFlushWithStacktrace : public JfrConditionalFlush<Event> {
Thread* _t;
bool _owner;
public:
JfrConditionalFlushWithStacktrace(Thread* t) : JfrConditionalFlush<Event>(t), _t(t), _owner(false) {
- if (Event::has_stacktrace() && jfr_has_stacktrace_enabled(Event::eventId)) {
+ if (this->_enabled && Event::has_stacktrace() && jfr_has_stacktrace_enabled(Event::eventId)) {
_owner = jfr_save_stacktrace(t);
}
}
~JfrConditionalFlushWithStacktrace() {
if (_owner) {
< prev index next >