Timer Class Reference#
|
Reference API
|
#include <ginkgo/core/base/timer.hpp>
Public Member Functions | |
| time_point | create_time_point () |
| virtual void | record (time_point &time)=0 |
| virtual void | wait (time_point &time)=0 |
| std::chrono::nanoseconds | difference (time_point &start, time_point &stop) |
| virtual std::chrono::nanoseconds | difference_async (const time_point &start, const time_point &stop)=0 |
Static Public Member Functions | |
| static std::unique_ptr< Timer > | create_for_executor (std::shared_ptr< const Executor > exec) |
Protected Member Functions | |
| virtual void | init_time_point (time_point &time)=0 |
Detailed Description
Represents a generic timer that can be used to record time points and measure time differences on host or device streams. To keep the runtime overhead of timing minimal, time points need to be allocated beforehand using Timer::create_time_point:
Member Function Documentation
◆ create_for_executor()
|
static |
Creates the timer type most suitable for recording accurate timings of kernels on the given executor.
- Parameters
-
exec the executor to create a Timer for
- Returns
- CpuTimer for ReferenceExecutor and OmpExecutor, CudaTimer for CudaExecutor, HipTimer for HipExecutor or DpcppTimer for DpcppExecutor.
◆ create_time_point()
| time_point gko::Timer::create_time_point | ( | ) |
Returns a newly created time point. Time points may only be used with the timer they were created with.
◆ difference()
| std::chrono::nanoseconds gko::Timer::difference | ( | time_point & | start, |
| time_point & | stop | ||
| ) |
Computes the difference between the two time points in nanoseconds. The function synchronizes with stop before computing the difference.
- Parameters
-
start the first time point (earlier) end the second time point (later)
- Returns
- the difference between the time points in nanoseconds.
◆ difference_async()
|
pure virtual |
Computes the difference between the two time points in nanoseconds. This asynchronous version does not synchronize itself, so the time points need to have been synchronized with, i.e. timer->wait(stop) needs to have been called. The version is intended for more advanced users who want to measure the overhead of timing functionality separately.
- Parameters
-
start the first time point (earlier) end the second time point (later)
- Returns
- the difference between the time points in nanoseconds.
Implemented in gko::CpuTimer, gko::CudaTimer, gko::HipTimer, and gko::DpcppTimer.
◆ init_time_point()
|
protectedpure virtual |
Initializes a new time_point instance for this timer.
Implemented in gko::CpuTimer, gko::CudaTimer, gko::HipTimer, and gko::DpcppTimer.
◆ record()
|
pure virtual |
Records a time point at the current time.
Implemented in gko::CpuTimer, gko::CudaTimer, gko::HipTimer, and gko::DpcppTimer.
◆ wait()
|
pure virtual |
Waits until all kernels in-process when recording the time point are finished.
Implemented in gko::CpuTimer, gko::CudaTimer, gko::HipTimer, and gko::DpcppTimer.
The documentation for this class was generated from the following file:
- ginkgo/core/base/timer.hpp
Generated by