216 return *this;
217 }
218 TimeInterval<Rep, TimeSource> operator+(const TimeInstant<Rep, TimeSource>& end) const {
219 return TimeInterval<Rep, TimeSource>(end, *this);
220 }
221 TimeInterval<Rep, TimeSource> operator-(const TimeInstant<Rep, TimeSource>& start) const {
222 return TimeInterval<Rep, TimeSource>(*this, start);
223 }
224 void stamp() {
225 this->_rep = TimeSource::now();
226 }
227 static TimeInstant<Rep, TimeSource> now() {
228 TimeInstant<Rep, TimeSource> temp;
229 temp.stamp();
230 return temp;
231 }
232 private:
233 TimeInstant(jlong ticks) : Rep<TimeSource>(ticks) {}
234 friend class GranularTimer;
235 friend class ObjectSample;
236 // GC VM tests
237 friend class TimePartitionPhasesIteratorTest;
238 friend class GCTimerTest;
239 };
240
241 #if INCLUDE_JFR
242 typedef TimeInstant<CompositeCounterRepresentation, CompositeElapsedCounterSource> Ticks;
243 typedef TimeInterval<CompositeCounterRepresentation, CompositeElapsedCounterSource> Tickspan;
244 #else
245 typedef TimeInstant<CounterRepresentation, ElapsedCounterSource> Ticks;
246 typedef TimeInterval<CounterRepresentation, ElapsedCounterSource> Tickspan;
247 #endif
248
249 #endif // SHARE_VM_UTILITIES_TICKS_HPP
|
216 return *this;
217 }
218 TimeInterval<Rep, TimeSource> operator+(const TimeInstant<Rep, TimeSource>& end) const {
219 return TimeInterval<Rep, TimeSource>(end, *this);
220 }
221 TimeInterval<Rep, TimeSource> operator-(const TimeInstant<Rep, TimeSource>& start) const {
222 return TimeInterval<Rep, TimeSource>(*this, start);
223 }
224 void stamp() {
225 this->_rep = TimeSource::now();
226 }
227 static TimeInstant<Rep, TimeSource> now() {
228 TimeInstant<Rep, TimeSource> temp;
229 temp.stamp();
230 return temp;
231 }
232 private:
233 TimeInstant(jlong ticks) : Rep<TimeSource>(ticks) {}
234 friend class GranularTimer;
235 friend class ObjectSample;
236 // GC unit tests
237 friend class TimePartitionPhasesIteratorTest;
238 friend class GCTimerTest;
239 };
240
241 #if INCLUDE_JFR
242 typedef TimeInstant<CompositeCounterRepresentation, CompositeElapsedCounterSource> Ticks;
243 typedef TimeInterval<CompositeCounterRepresentation, CompositeElapsedCounterSource> Tickspan;
244 #else
245 typedef TimeInstant<CounterRepresentation, ElapsedCounterSource> Ticks;
246 typedef TimeInterval<CounterRepresentation, ElapsedCounterSource> Tickspan;
247 #endif
248
249 #endif // SHARE_VM_UTILITIES_TICKS_HPP
|