nvtt
|
A TimingContext is a way to collect timing data from a number of functions, and report how much time each function took. More...
#include <nvtt.h>
Public Member Functions | |
NVTT_API | TimingContext (int detailLevel=1) |
Creates a TimingContext with the given detailLevel . | |
NVTT_API | ~TimingContext () |
Destructor. | |
NVTT_API void | SetDetailLevel (int detailLevel) |
Sets this TimingContext's detail level. | |
NVTT_API int | GetRecordCount () |
Returns the number of timing records stored. | |
NVTT_DEPRECATED_API void | GetRecord (int i, char *description, double &seconds) |
Returns the description and length in seconds of the i th record. | |
NVTT_API size_t | GetRecord (int i, char *outDescription, size_t outDescriptionSize, double &outSeconds) |
Returns the description and length in seconds of the i th record. | |
NVTT_API void | PrintRecords () |
Prints all records including their levels of nesting. | |
Public Attributes | |
Private * | m |
A TimingContext is a way to collect timing data from a number of functions, and report how much time each function took.
Since NVTT 3.0, many functions will take an optional TimingContext pointer. If the detailLevel
of the TimingContext is high enough, the function will record the function name and how much CPU time the function took, synchronizing with the CPU if necessary. One can then get individual records using GetRecord(), or print all statistics using PrintRecords().
NVTT_API nvtt::TimingContext::TimingContext | ( | int | detailLevel = 1 | ) |
Creates a TimingContext with the given detailLevel
.
Functions will only collect timing data if their detail level (usually 2 or 3) is less than or equal to the TimingContext's detailLevel
.
NVTT_DEPRECATED_API void nvtt::TimingContext::GetRecord | ( | int | i, |
char * | description, | ||
double & | seconds ) |
Returns the description and length in seconds of the i
th record.
The description is strcopied directly into description
, which must be long enough.
NVTT_API size_t nvtt::TimingContext::GetRecord | ( | int | i, |
char * | outDescription, | ||
size_t | outDescriptionSize, | ||
double & | outSeconds ) |
Returns the description and length in seconds of the i
th record.
outDescriptionSize
is the size in bytes of the buffer pointed to by outDescription
. GetRecord() truncates (if necessary) the record's description to outDescriptionSize-1
bytes, and always writes a null terminator.
Returns the number of bytes written, not including the null terminator. If outDescription
is null, returns the number of bytes in the record's description. If i
is out of bounds, returns 0.
NVTT_API void nvtt::TimingContext::PrintRecords | ( | ) |
Prints all records including their levels of nesting.
NVTT keeps track of how deeply timers are nested, so this will print out each description and length with an indentation corresponding to its nesting depth.
NVTT_API void nvtt::TimingContext::SetDetailLevel | ( | int | detailLevel | ) |
Sets this TimingContext's detail level.
Functions will only collect timing data if their detail level (usually 2 or 3) is less than or equal to the TimingContext's detailLevel
.