Added a TODO to deprecate NB timing structures in favor of new
functionality.
Change-Id: Idb78e5a36a7f372f01378a580a05b928bd728c57
/*! \libinternal \brief
* This is a GPU region timing wrapper class.
/*! \libinternal \brief
* This is a GPU region timing wrapper class.
- * It allows for host-side tracking of the execution timespans in GPU code
+ * It allows for host-side tracking of the accumulated execution timespans in GPU code
* (measuring kernel or transfers duration).
* It also partially tracks the correctness of the timer state transitions,
* as far as current implementation allows (see TODO in getLastRangeTime() for a disabled check).
* (measuring kernel or transfers duration).
* It also partially tracks the correctness of the timer state transitions,
* as far as current implementation allows (see TODO in getLastRangeTime() for a disabled check).
+ //! The number of times the timespan has been measured
+ unsigned int callCount_;
+ //! The accumulated duration of the timespans measured (milliseconds)
+ double totalMilliseconds_;
//! The underlying region timer implementation
GpuRegionTimerImpl<framework> impl_;
//! The underlying region timer implementation
GpuRegionTimerImpl<framework> impl_;
GMX_ASSERT(debugState_ == TimerState::Recording, error.c_str());
debugState_ = TimerState::Stopped;
}
GMX_ASSERT(debugState_ == TimerState::Recording, error.c_str());
debugState_ = TimerState::Stopped;
}
impl_.closeTimingRegion(s);
}
/*! \brief
impl_.closeTimingRegion(s);
}
/*! \brief
- * Returns the last timespan, and resets the internal timer state.
+ * Accumulates the last timespan of all the events used into the the total duration,
+ * and resets the internal timer state.
* To be called after closeTimingRegion() and the command stream of the event having been synchronized.
* \returns The last timespan (in milliseconds).
*/
* To be called after closeTimingRegion() and the command stream of the event having been synchronized.
* \returns The last timespan (in milliseconds).
*/
debugState_ = TimerState::Idle;
}
double milliseconds = impl_.getLastRangeTime();
debugState_ = TimerState::Idle;
}
double milliseconds = impl_.getLastRangeTime();
+ totalMilliseconds_ += milliseconds;
return milliseconds;
}
/*! \brief Resets the implementation and total time/call count to zeroes. */
return milliseconds;
}
/*! \brief Resets the implementation and total time/call count to zeroes. */
{
debugState_ = TimerState::Idle;
}
{
debugState_ = TimerState::Idle;
}
+ totalMilliseconds_ = 0.0;
+ callCount_ = 0;
+ /*! \brief Gets total time recorded (in milliseconds). */
+ double getTotalTime() const
+ {
+ return totalMilliseconds_;
+ }
+ /*! \brief Gets total call count recorded. */
+ unsigned int getCallCount() const
+ {
+ return callCount_;
+ }
/*! \brief
* Gets a pointer to a new timing event for passing into individual GPU API calls
* within the region if they require it (e.g. on OpenCL).
/*! \brief
* Gets a pointer to a new timing event for passing into individual GPU API calls
* within the region if they require it (e.g. on OpenCL).
* setting bDoTime needs to be change if this CUDA "feature" gets fixed. */
bool bDoTime; /**< True if event-based timing is enabled. */
cu_timers_t *timers; /**< CUDA event-based timers. */
* setting bDoTime needs to be change if this CUDA "feature" gets fixed. */
bool bDoTime; /**< True if event-based timing is enabled. */
cu_timers_t *timers; /**< CUDA event-based timers. */
- gmx_wallclock_gpu_t *timings; /**< Timing data. */
+ gmx_wallclock_gpu_t *timings; /**< Timing data. TODO: deprecate this and query timers for accumulated data instead */
cl_bool bDoTime; /**< True if event-based timing is enabled. */
cl_timers_t *timers; /**< OpenCL event-based timers. */
cl_bool bDoTime; /**< True if event-based timing is enabled. */
cl_timers_t *timers; /**< OpenCL event-based timers. */
- struct gmx_wallclock_gpu_t *timings; /**< Timing data. */
+ struct gmx_wallclock_gpu_t *timings; /**< Timing data. TODO: deprecate this and query timers for accumulated data instead */