#ifndef TRACEFILES_TRACEEVENTCLASSES_HPP #define TRACEFILES_TRACEEVENTCLASSES_HPP // On purpose outside the INCLUDE_TRACE // Some parts of traceEvent.hpp are used outside of // INCLUDE_TRACE #include "trace/traceEvent.hpp" #include "tracefiles/traceTypes.hpp" #include "utilities/macros.hpp" #if INCLUDE_TRACE #include "jfr/recorder/service/jfrEvent.hpp" /* * Each event class has an assert member function verify() which is invoked * just before the engine writes the event and its fields to the data stream. * The purpose of verify() is to ensure that all fields in the event are initialized * and set before attempting to commit. * * We enforce this requirement because events are generally stack allocated and therefore * *not* initialized to default values. This prevents us from inadvertently committing * uninitialized values to the data stream. * * The assert message contains both the index (zero based) as well as the name of the field. */ #else // !INCLUDE_TRACE class TraceEvent { public: TraceEvent() {} void set_starttime(const JfrTraceTime& ignore) const {} void set_endtime(const JfrTraceTime& ignore) const {} void set_starttime(const Ticks& ignore) const {} void set_endtime(const Ticks& ignore) const {} bool should_commit() const { return false; } static bool is_enabled() { return false; } void commit() {} }; #endif // INCLUDE_TRACE #endif // JFRFILES_JFREVENTCLASSES_HPP struct TraceStruct { private: public: template <typename Writer> void writeData(Writer& w) { } }; struct TraceStruct { public: }; { public: }; { private: public: static const bool hasThread = ; static const bool hasStackTrace = ; static const bool isInstant = ; static const bool hasCutoff = ; static const bool isRequestable = ; static const TraceEventId eventId = ; template <typename Writer> void writeData(Writer& w) { } ( , ) : JfrTraceEvent<>(TIMED) { if (should_commit()) { set_(); } } void commit( , ) { if (should_commit()) { set_(); commit(); } } static void commit(const Ticks& startTicks, const Ticks& endTicks, , ) { me(UNTIMED); if (me.should_commit()) { me.set_starttime(startTicks); me.set_endtime(endTicks); me.set_(); me.commit(); } } #ifdef ASSERT void verify() const { } #endif }; }