nvtt
Loading...
Searching...
No Matches
Public Member Functions | Public Attributes | List of all members
nvtt::TimingContext Struct Reference

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 ith record.
 
NVTT_API size_t GetRecord (int i, char *outDescription, size_t outDescriptionSize, double &outSeconds)
 Returns the description and length in seconds of the ith record.
 
NVTT_API void PrintRecords ()
 Prints all records including their levels of nesting.
 

Public Attributes

Private * m
 

Detailed Description

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().

Since
NVTT 3.0

Constructor & Destructor Documentation

◆ TimingContext()

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.

Member Function Documentation

◆ GetRecord() [1/2]

NVTT_DEPRECATED_API void nvtt::TimingContext::GetRecord ( int i,
char * description,
double & seconds )

Returns the description and length in seconds of the ith record.

Deprecated
GetRecord(int, char*, double&) doesn't check the length of its description argument before copying an arbitrary-length string into it. Please use GetRecord(int, char*, size_t, double&) instead.

The description is strcopied directly into description, which must be long enough.

◆ GetRecord() [2/2]

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 ith 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.

◆ PrintRecords()

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.

◆ SetDetailLevel()

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.


The documentation for this struct was generated from the following file: