A simple imeplementation of the IErrorRecorder interface for use by samples. More...
Public Types | |
using | ErrorDesc = const char * |
A typedef of a c-style string for reporting error descriptions. More... | |
using | RefCount = int32_t |
A typedef of a 32bit integer for reference counting. More... | |
Public Member Functions | |
SampleErrorRecorder ()=default | |
virtual | ~SampleErrorRecorder () noexcept |
int32_t | getNbErrors () const noexcept final |
Return the number of errors. More... | |
ErrorCode | getErrorCode (int32_t errorIdx) const noexcept final |
Returns the ErrorCode enumeration. More... | |
IErrorRecorder::ErrorDesc | getErrorDesc (int32_t errorIdx) const noexcept final |
Returns the c-style string description of the error. More... | |
bool | hasOverflowed () const noexcept final |
Determine if the error stack has overflowed. More... | |
void | clear () noexcept final |
Clear the error stack on the error recorder. More... | |
bool | empty () const noexcept |
Simple helper function that. More... | |
bool | reportError (ErrorCode val, IErrorRecorder::ErrorDesc desc) noexcept final |
report an error to the error recorder with the corresponding enum and description. More... | |
IErrorRecorder::RefCount | incRefCount () noexcept final |
Increments the refcount for the current ErrorRecorder. More... | |
IErrorRecorder::RefCount | decRefCount () noexcept final |
Decrements the refcount for the current ErrorRecorder. More... | |
Private Types | |
using | errorPair = std::pair< ErrorCode, std::string > |
using | errorStack = std::vector< errorPair > |
Private Member Functions | |
const errorPair & | operator[] (size_t index) const noexcept |
bool | indexCheck (int32_t index) const noexcept |
Private Attributes | |
std::mutex | mStackLock |
std::atomic< int32_t > | mRefCount {0} |
errorStack | mErrorStack |
A simple imeplementation of the IErrorRecorder interface for use by samples.
This interface also can be used as a reference implementation. The sample Error recorder is based on a vector that pairs the error code and the error string into a single element. It also uses standard mutex's and atomics in order to make sure that the code works in a multi-threaded environment. SampleErrorRecorder is not intended for use in automotive safety environments.
|
private |
|
private |
|
inherited |
A typedef of a c-style string for reporting error descriptions.
|
inherited |
A typedef of a 32bit integer for reference counting.
|
default |
|
inlinevirtualnoexcept |
|
inlinefinalvirtualnoexcept |
Return the number of errors.
Determines the number of errors that occurred between the current point in execution and the last time that the clear() was executed. Due to the possibility of asynchronous errors occuring, a TensorRT API can return correct results, but still register errors with the Error Recorder. The value of getNbErrors must monotonically increases until clear() is called.
Implements nvinfer1::IErrorRecorder.
|
inlinefinalvirtualnoexcept |
Returns the ErrorCode enumeration.
errorIdx | A 32bit integer that indexes into the error array. |
The errorIdx specifies what error code from 0 to getNbErrors()-1 that the application wants to analyze and return the error code enum.
Implements nvinfer1::IErrorRecorder.
|
inlinefinalvirtualnoexcept |
Returns the c-style string description of the error.
errorIdx | A 32bit integer that indexes into the error array. |
For the error specified by the idx value, return the string description of the error. The error string is a c-style string that is zero delimited. In the safety context there is a constant length requirement to remove any dynamic memory allocations and the error message may be truncated. The format of the string is "<EnumAsStr> - <Description>".
Implements nvinfer1::IErrorRecorder.
|
inlinefinalvirtualnoexcept |
Determine if the error stack has overflowed.
In the case when the number of errors is large, this function is used to query if one or more errors have been dropped due to lack of storage capacity. This is especially important in the automotive safety case where the internal error handling mechanisms cannot allocate memory.
Implements nvinfer1::IErrorRecorder.
|
inlinefinalvirtualnoexcept |
Clear the error stack on the error recorder.
Removes all the tracked errors by the error recorder. This function must guarantee that after this function is called, and as long as no error occurs, the next call to getNbErrors will return zero.
Implements nvinfer1::IErrorRecorder.
|
inlinenoexcept |
Simple helper function that.
|
inlinefinalvirtualnoexcept |
report an error to the error recorder with the corresponding enum and description.
val | The error code enum that is being reported. |
desc | The string description of the error. |
Report an error to the user that has a given value and human readable description. The function returns false if processing can continue, which implies that the reported error is not fatal. This does not guarantee that processing continues, but provides a hint to TensorRT.
Implements nvinfer1::IErrorRecorder.
|
inlinefinalvirtualnoexcept |
Increments the refcount for the current ErrorRecorder.
Increments the reference count for the object by one and returns the current value. This reference count allows the application to know that an object inside of TensorRT has taken a reference to the ErrorRecorder. If the ErrorRecorder is released before the reference count hits zero, then behavior in TensorRT is undefined. It is strongly recommended that the increment is an atomic operation. TensorRT guarantees that each incRefCount called on an objects construction is paired with a decRefCount call when an object is destructed.
Implements nvinfer1::IErrorRecorder.
|
inlinefinalvirtualnoexcept |
Decrements the refcount for the current ErrorRecorder.
Decrements the reference count for the object by one and returns the current value. It is undefined behavior to call decRefCount when RefCount is zero. If the ErrorRecorder is destroyed before the reference count hits zero, then behavior in TensorRT is undefined. It is strongly recommended that the decrement is an atomic operation. TensorRT guarantees that each decRefCount called when an object is destructed is paired with a incRefCount call when that object was constructed.
Implements nvinfer1::IErrorRecorder.
|
inlineprivatenoexcept |
|
inlineprivatenoexcept |
|
private |
|
private |
|
private |