RenderManAPI  24.0
RixStats Class Referenceabstract

NOTE: This interface will be deprecated when a new interface comes in the next release Interface for including user statistics in XML file. More...

#include <RixInterfaces.h>

Inherits RixInterface.

Classes

class  SimpleStat
 Add a generic statistic via a subclass of the SimpleStat class interface. More...
 

Public Types

typedef void(* Reporter) (class RixXmlFile *file)
 A reporting function takes a RixXmlFile and writes to it using WriteXml and WriteText. More...
 
typedef void(* ReporterCtx) (void *ctx, class RixXmlFile *)
 
enum  Type {
  k_Float, k_Integer, k_StringV, k_Color,
  k_Normal, k_Vector, k_Point, k_HPoint,
  k_MPoint, k_Matrix
}
 

Public Member Functions

virtual void AddTimerStat (float *seconds, const char *name, const char *description)=0
 Add a timer statistic, which is simply a pointer to a float into which the plugin has accumulated timing information (in seconds). More...
 
virtual int AddSimpleStat (SimpleStat *)=0
 
virtual void AddMemoryStat (size_t *bytes, const char *name, const char *description)=0
 Add a memory statistic, which is simply a pointer to a size_t into which the plugin has accumulated memory usage information (in bytes). More...
 
virtual void AddReporter (Reporter func)=0
 Register a statistics reporter, which is called at the end of each frame after built-in statistics are reported (if statistics are enabled). More...
 
virtual void AddReporterCtx (ReporterCtx func, void *ctx)=0
 
virtual void AddFileLogStat (const char *fileName, const char *path)=0
 Add a file to the fileLog statistic. More...
 
virtual int GetVersion () const
 Get the version number of this interface. More...
 

Protected Member Functions

 RixStats ()
 Constructor is for internal use only. More...
 

Protected Attributes

int m_version
 Version number of this interface. More...
 

Detailed Description

NOTE: This interface will be deprecated when a new interface comes in the next release Interface for including user statistics in XML file.

Thread safe.

Plugins can report elapsed time and peak memory usage statistics via AddTimerStat and AddMemoryStat. Other user-defined statistics can be reported via AddReporter. If statistics are enabled, plugin statistics are reported at the end of each frame, after the built-in statistics are reported.

Note that shader plugins must take care to ensure thread safety when recording statistics in global variables. Controlling access with a mutex is straightforward. Alternatively, statistics can be recorded in per-thread data and then combined at the end of a frame. See the RSL Plugin application note or the reference documentation for RslContext::SetThreadData for more information.

Member Typedef Documentation

◆ Reporter

typedef void(* RixStats::Reporter) (class RixXmlFile *file)

A reporting function takes a RixXmlFile and writes to it using WriteXml and WriteText.

◆ ReporterCtx

typedef void(* RixStats::ReporterCtx) (void *ctx, class RixXmlFile *)

Member Enumeration Documentation

◆ Type

enum RixInterface::Type
inherited
Enumerator
k_Float 
k_Integer 
k_StringV 
k_Color 
k_Normal 
k_Vector 
k_Point 
k_HPoint 
k_MPoint 
k_Matrix 

Constructor & Destructor Documentation

◆ RixStats()

RixStats::RixStats ( )
inlineprotected

Constructor is for internal use only.

Member Function Documentation

◆ AddFileLogStat()

virtual void RixStats::AddFileLogStat ( const char *  fileName,
const char *  path 
)
pure virtual

Add a file to the fileLog statistic.

This filename will be copied and reported alongside all the other files in the fileLog. By convention // is used to distinguish the search path from the absolute path of the filename being logged.

◆ AddMemoryStat()

virtual void RixStats::AddMemoryStat ( size_t *  bytes,
const char *  name,
const char *  description 
)
pure virtual

Add a memory statistic, which is simply a pointer to a size_t into which the plugin has accumulated memory usage information (in bytes).

The name must be a valid XML token; the description may be empty. A duplicate call with the same name as a previously added statistic is ignored (a warning is generated if a different pointer is specified). The name and description are copied.

◆ AddReporter()

virtual void RixStats::AddReporter ( Reporter  func)
pure virtual

Register a statistics reporter, which is called at the end of each frame after built-in statistics are reported (if statistics are enabled).

Duplicate calls with the same reporter are ignored. Here is an example of a simple reporting function:

void myReporter(RixXmlFile* file)
{
file->WriteXml ("<stats name=\"myPlugin\">\n");
file->WriteXml (" <int name=\"count\"> %i </int>\n", myCounter);
file->WriteXml (" <string name=\"info\">\n");
file->WriteText(" %s\n", myInfo);
file->WriteXml (" </string>\n");
file->WriteXml ("</stats>\n");
}

◆ AddReporterCtx()

virtual void RixStats::AddReporterCtx ( ReporterCtx  func,
void *  ctx 
)
pure virtual

◆ AddSimpleStat()

virtual int RixStats::AddSimpleStat ( SimpleStat )
pure virtual

◆ AddTimerStat()

virtual void RixStats::AddTimerStat ( float *  seconds,
const char *  name,
const char *  description 
)
pure virtual

Add a timer statistic, which is simply a pointer to a float into which the plugin has accumulated timing information (in seconds).

The name must be a valid XML token; the description may be empty. A duplicate call with the same name as a previously added statistic is ignored (a warning is generated if a different pointer is specified). The name and description are copied.

◆ GetVersion()

virtual int RixInterface::GetVersion ( ) const
inlinevirtualinherited

Get the version number of this interface.

Different interfaces might have different version numbers in a given release.

References RixInterface::m_version.

Member Data Documentation

◆ m_version

int RixInterface::m_version
protectedinherited

Version number of this interface.

Referenced by RixInterface::GetVersion().


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