#include <nanovdb/util/cuda/Timer.h>
|
| | Timer (cudaStream_t stream=0) |
| | Default constructor.
|
| | Timer (const std::string &msg, cudaStream_t stream=0, std::ostream &os=std::cerr) |
| | Construct and start the timer.
|
| | ~Timer () |
| | Destructor.
|
| void | start () |
| | Start the timer.
|
| void | start (const std::string &msg, std::ostream &os=std::cerr) |
| | Start the timer.
|
| void | start (const char *msg, std::ostream &os=std::cerr) |
| | Start the timer.
|
| void | record () |
| float | milliseconds () const |
| | Return the time in milliseconds since record was called.
|
| float | elapsed () |
| | elapsed time (since start) in miliseconds
|
| void | print (std::ostream &os=std::cerr) |
| | Prints the elapsed time in milliseconds to a stream.
|
| void | print (const char *msg, std::ostream &os=std::cerr) |
| | Prints a message followed by the elapsed time in milliseconds to a stream.
|
| void | print (const std::string &msg, std::ostream &os=std::cerr) |
| | Like the above method but with a std::string arguments.
|
| void | stop (std::ostream &os=std::cerr) |
| | stop the timer
|
| void | restart (const std::string &msg, std::ostream &os=std::cerr) |
| | stop and start the timer
|
◆ Timer() [1/2]
| Timer |
( |
cudaStream_t | stream = 0 | ) |
|
|
inline |
Default constructor.
- Parameters
-
| stream | CUDA stream to be timed (defaults to stream 0) |
- Note
- Starts the timer
- Warning
cudaEventCreate creates the event for the current device and cudaEventRecord requires that the event and stream are associated with the same device. So it's important to call cudaSetDevice(device) so device matches the one used when stream was created.
◆ Timer() [2/2]
| Timer |
( |
const std::string & | msg, |
|
|
cudaStream_t | stream = 0, |
|
|
std::ostream & | os = std::cerr ) |
|
inline |
Construct and start the timer.
- Parameters
-
| msg | string message to be printed when timer is started |
| stream | CUDA stream to be timed (defaults to stream 0) |
| os | output stream for the message above |
- Warning
cudaEventCreate creates the event for the current device and cudaEventRecord requires that the event and stream are associated with the same device. So it's important to call cudaSetDevice(device) so device matches the one used when stream was created.
◆ ~Timer()
◆ elapsed()
elapsed time (since start) in miliseconds
- Returns
- elapsed time (since start) in miliseconds
◆ milliseconds()
| float milliseconds |
( |
| ) |
const |
|
inline |
Return the time in milliseconds since record was called.
◆ print() [1/3]
| void print |
( |
const char * | msg, |
|
|
std::ostream & | os = std::cerr ) |
|
inline |
Prints a message followed by the elapsed time in milliseconds to a stream.
- Parameters
-
| msg | message to print before the time |
| os | stream to print to |
◆ print() [2/3]
| void print |
( |
const std::string & | msg, |
|
|
std::ostream & | os = std::cerr ) |
|
inline |
Like the above method but with a std::string arguments.
◆ print() [3/3]
| void print |
( |
std::ostream & | os = std::cerr | ) |
|
|
inline |
Prints the elapsed time in milliseconds to a stream.
- Parameters
-
| os | output stream to print to |
◆ record()
- Warning
cudaEventRecord requires that the event and stream are associated with the same device. So it's important to call cudaSetDevice(device) so it matches the device used when mStream was created.
◆ restart()
| void restart |
( |
const std::string & | msg, |
|
|
std::ostream & | os = std::cerr ) |
|
inline |
stop and start the timer
- Parameters
-
| msg | string message to be printed when timer is started |
| os | output stream for the message above |
- Warning
- Remember to call start before restart
◆ start() [1/3]
Start the timer.
- Warning
cudaEventRecord requires that the event and stream are associated with the same device. So it's important to call cudaSetDevice(device) so device matches the one used when mStream was created.
◆ start() [2/3]
| void start |
( |
const char * | msg, |
|
|
std::ostream & | os = std::cerr ) |
|
inline |
Start the timer.
- Parameters
-
| msg | string message to be printed when timer is started |
| os | output stream for the message above |
◆ start() [3/3]
| void start |
( |
const std::string & | msg, |
|
|
std::ostream & | os = std::cerr ) |
|
inline |
Start the timer.
- Parameters
-
| msg | string message to be printed when timer is started |
| os | output stream for the message above |
◆ stop()
| void stop |
( |
std::ostream & | os = std::cerr | ) |
|
|
inline |
stop the timer
- Parameters
-
| os | output stream for the message above |