src/share/vm/trace/traceEvent.hpp
Print this page
rev 5685 : 8028128: Add a type safe alternative for working with counter based data
Reviewed-by:
@@ -23,39 +23,48 @@
*/
#ifndef SHARE_VM_TRACE_TRACEEVENT_HPP
#define SHARE_VM_TRACE_TRACEEVENT_HPP
+#include "utilities/macros.hpp"
+
enum EventStartTime {
UNTIMED,
TIMED
};
-#include "utilities/macros.hpp"
-
#if INCLUDE_TRACE
#include "trace/traceBackend.hpp"
#include "trace/tracing.hpp"
#include "tracefiles/traceEventIds.hpp"
#include "tracefiles/traceTypes.hpp"
+#include "utilities/ticks.hpp"
template<typename T>
class TraceEvent : public StackObj {
- protected:
- jlong _startTime;
- jlong _endTime;
-
private:
bool _started;
#ifdef ASSERT
bool _committed;
bool _cancelled;
protected:
bool _ignore_check;
#endif
+ protected:
+ jlong _startTime;
+ jlong _endTime;
+
+ void set_starttime(const TracingTime& time) {
+ _startTime = time;
+ }
+
+ void set_endtime(const TracingTime& time) {
+ _endTime = time;
+ }
+
public:
TraceEvent(EventStartTime timing=TIMED) :
_startTime(0),
_endTime(0),
_started(false)
@@ -98,16 +107,16 @@
static_cast<T*>(this)->writeEvent();
}
set_commited();
}
- void set_starttime(jlong time) {
- _startTime = time;
+ void set_starttime(const Ticks& time) {
+ _startTime = time.value();
}
- void set_endtime(jlong time) {
- _endTime = time;
+ void set_endtime(const Ticks& time) {
+ _endTime = time.value();
}
TraceEventId id() const {
return T::eventId;
}