HDK
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Groups Pages
UT_PerfMonStats Class Reference

A collection of statistics for a particular object (i.e. node, viewport). More...

#include <UT_PerfMonStats.h>

Public Member Functions

 UT_PerfMonStats ()
 
 UT_PerfMonStats (const UT_PerfMonStats *stats1, const UT_PerfMonStats *stats2=NULL, const char *title1=NULL, const char *title2=NULL)
 
 UT_PerfMonStats (const char *name, const char *path, const char *icon, UT_PerfMonObjectType type, UT_PerfMonStats *parent=NULL)
 
 UT_PerfMonStats (const UT_PerfMonStats &src)
 
UT_PerfMonStatsoperator= (const UT_PerfMonStats &src)
 
 ~UT_PerfMonStats ()
 
const char * name () const
 Return the name of the object that the stats apply to. More...
 
void setName (const char *name)
 Set the name of the object that the stats apply to. More...
 
const char * path () const
 Return the full path of the object that the stats apply to. More...
 
void setPath (const char *path)
 Set the path of the object that the stats apply to. More...
 
const char * extraInfo () const
 Return extra information about this stats object. More...
 
void setExtraInfo (const char *extra_info)
 Set extra information pertaining to this stats object. More...
 
UT_PerfMonObjectType type () const
 Return the type of the object that the stats apply to. More...
 
void setType (UT_PerfMonObjectType type)
 Set the type of the object that the stats apply to. More...
 
const char * icon () const
 
void setIcon (const char *icon)
 Set the object icon. More...
 
bool isIconSet () const
 
void setParent (UT_PerfMonStats *parent)
 Set the parent stat object. More...
 
UT_PerfMonStatsparent () const
 
void appendChild (UT_PerfMonStats *child)
 Append a child stat object. More...
 
const UT_PerfMonStatsListchildren () const
 Return a list of the object's children. More...
 
const UT_StringArraystats () const
 Return a list of stat names that are tracked by this object. More...
 
bool hasStat (const char *stat_name) const
 
fpreal value (const UT_StringRef &stat_name) const
 This method will always return the value over all threads and frames. More...
 
fpreal value (const char *stat_name, int first_frame, int last_frame, int thread_id=UT_PERFMON_STAT_WALL_TIME) const
 This method returns the values over the given frame range and thread id. More...
 
UT_ValArray< std::pair< int,
fpreal > > 
threadedValue (const char *stat_name, int first_frame=UT_PERFORMANCE_INVALID_FRAME, int last_frame=UT_PERFORMANCE_INVALID_FRAME) const
 Return a list of values separated by thread. More...
 
fpreal valueForThread (const char *stat_name, int thread_id) const
 Sum the value for the given stat name and thread id for ALL frames. More...
 
void setValue (const UT_PerfMonStatDefinition *stat_def, int thread_id, int frame, fpreal stat_value)
 Set the specified stat to the given value. More...
 
void setValue (const UT_PerfMonStatDefinition *stat_def, fpreal stat_value)
 
void addToValue (const UT_PerfMonStatDefinition *stat_def, int thread_id, int frame, fpreal stat_value)
 
fpreal normalizedPercentage (const char *time_stat_name, fpreal time_value) const
 
void save (UT_JSONWriter &writer) const
 Save the stats using the specified JSON writer. More...
 
void updateStatsFromDeltas ()
 

Static Public Member Functions

static bool isArtificialStatObject (const char *stat_obj_path)
 
static void convertToArtificialStatObjectName (UT_WorkBuffer &artificial_obj_name, const char *stat_obj_name)
 
static void convertToRealStatObjectName (UT_String &artificial_stat_obj_name)
 
static void buildObjectPath (UT_WorkBuffer &path, const char *real_object_path, const char *artificial_object_name)
 
static void splitObjectPath (const char *path, UT_String &real_object_path, UT_String &artificial_object_name)
 
static void splitParentPath (const char *path, UT_String &parent_path, UT_String &object_name)
 
static const char * rootStatsTitle ()
 Return the title for the root statistics. More...
 
static const char * unaccountedStatsTitle ()
 Return the title for the unaccounted statistics. More...
 

Detailed Description

A collection of statistics for a particular object (i.e. node, viewport).

Definition at line 107 of file UT_PerfMonStats.h.

Constructor & Destructor Documentation

UT_PerfMonStats::UT_PerfMonStats ( )
UT_PerfMonStats::UT_PerfMonStats ( const UT_PerfMonStats stats1,
const UT_PerfMonStats stats2 = NULL,
const char *  title1 = NULL,
const char *  title2 = NULL 
)
UT_PerfMonStats::UT_PerfMonStats ( const char *  name,
const char *  path,
const char *  icon,
UT_PerfMonObjectType  type,
UT_PerfMonStats parent = NULL 
)
UT_PerfMonStats::UT_PerfMonStats ( const UT_PerfMonStats src)

Copy constructor. Will be slow as it creates a deep copy; only suitable for use in tests. NOTE: Creates deep copies of children stats, but does not copy the parent stats.

UT_PerfMonStats::~UT_PerfMonStats ( )

Member Function Documentation

void UT_PerfMonStats::addToValue ( const UT_PerfMonStatDefinition stat_def,
int  thread_id,
int  frame,
fpreal  stat_value 
)

Add the given value to the current value of the specified stat. Use this method if you want to keep track of delta values that can be used later to generate statistics in updateStatsFromDeltas(). Otherwise, call setValue() instead.

void UT_PerfMonStats::appendChild ( UT_PerfMonStats child)

Append a child stat object.

static void UT_PerfMonStats::buildObjectPath ( UT_WorkBuffer path,
const char *  real_object_path,
const char *  artificial_object_name 
)
static

Build a stat object path using the given real object path and artificial object name.

const UT_PerfMonStatsList& UT_PerfMonStats::children ( ) const

Return a list of the object's children.

static void UT_PerfMonStats::convertToArtificialStatObjectName ( UT_WorkBuffer artificial_obj_name,
const char *  stat_obj_name 
)
static

Convert the given stat object name to one that uses notation that denotes that it is an artificial object.

static void UT_PerfMonStats::convertToRealStatObjectName ( UT_String artificial_stat_obj_name)
static

Convert the given stat object name to one that does not have notation which denotes it as an artificial object.

const char* UT_PerfMonStats::extraInfo ( ) const

Return extra information about this stats object.

bool UT_PerfMonStats::hasStat ( const char *  stat_name) const

Return true if the object contains the given stat. Return false otherwise.

const char* UT_PerfMonStats::icon ( ) const

Return the icon name associated with the collection of stats. Return NULL if no such icon exists.

static bool UT_PerfMonStats::isArtificialStatObject ( const char *  stat_obj_path)
static

Return true if the given stat object is an artificial object, that is, it is not really an object (like a node or a viewport) but can be attached to a real object. For example, '{drawlist}' is an artificial stat object that is a part of either a node, a viewport or on its own.

bool UT_PerfMonStats::isIconSet ( ) const

Return true if the icon has been set. Note that this does not mean that the icon is not NULL, just that the object's icon has been determined.

const char* UT_PerfMonStats::name ( ) const

Return the name of the object that the stats apply to.

fpreal UT_PerfMonStats::normalizedPercentage ( const char *  time_stat_name,
fpreal  time_value 
) const

Return the normalized percentage of the given time value when compared to the maximum time value reported by the stat object's children. Return 0 if the normalized percentage cannot be calculated.

UT_PerfMonStats& UT_PerfMonStats::operator= ( const UT_PerfMonStats src)

Assignment operator. Will be slow as it creates a deep copy; only suitable for use in tests. NOTE: Creates deep copies of children stats, but does not copy the parent stats.

UT_PerfMonStats* UT_PerfMonStats::parent ( ) const

Return the object that this object is parented to. Return NULL if this is the root object.

const char* UT_PerfMonStats::path ( ) const

Return the full path of the object that the stats apply to.

static const char* UT_PerfMonStats::rootStatsTitle ( )
static

Return the title for the root statistics.

void UT_PerfMonStats::save ( UT_JSONWriter writer) const

Save the stats using the specified JSON writer.

void UT_PerfMonStats::setExtraInfo ( const char *  extra_info)

Set extra information pertaining to this stats object.

void UT_PerfMonStats::setIcon ( const char *  icon)

Set the object icon.

void UT_PerfMonStats::setName ( const char *  name)

Set the name of the object that the stats apply to.

void UT_PerfMonStats::setParent ( UT_PerfMonStats parent)

Set the parent stat object.

void UT_PerfMonStats::setPath ( const char *  path)

Set the path of the object that the stats apply to.

void UT_PerfMonStats::setType ( UT_PerfMonObjectType  type)

Set the type of the object that the stats apply to.

void UT_PerfMonStats::setValue ( const UT_PerfMonStatDefinition stat_def,
int  thread_id,
int  frame,
fpreal  stat_value 
)

Set the specified stat to the given value.

void UT_PerfMonStats::setValue ( const UT_PerfMonStatDefinition stat_def,
fpreal  stat_value 
)

Set the specified stat to the given value. This method should be called for stats that are independent of frames and threads (i.e. avg, min, max).

static void UT_PerfMonStats::splitObjectPath ( const char *  path,
UT_String real_object_path,
UT_String artificial_object_name 
)
static

Split the given object path into its real object path and its artificial name. If the path does not have a real object path, then real_object_path.isstring() will be false. Likewise, if the path does not have an artificial name, then artificial_object_name.isstring() will be false.

static void UT_PerfMonStats::splitParentPath ( const char *  path,
UT_String parent_path,
UT_String object_name 
)
static

Split the given object path into its parent path and object name. If the path does not have a parent, then parent_path.isstring() will be false.

const UT_StringArray& UT_PerfMonStats::stats ( ) const

Return a list of stat names that are tracked by this object.

UT_ValArray<std::pair<int, fpreal> > UT_PerfMonStats::threadedValue ( const char *  stat_name,
int  first_frame = UT_PERFORMANCE_INVALID_FRAME,
int  last_frame = UT_PERFORMANCE_INVALID_FRAME 
) const

Return a list of values separated by thread.

UT_PerfMonObjectType UT_PerfMonStats::type ( ) const

Return the type of the object that the stats apply to.

static const char* UT_PerfMonStats::unaccountedStatsTitle ( )
static

Return the title for the unaccounted statistics.

void UT_PerfMonStats::updateStatsFromDeltas ( )

Update the cumulative and total time stats using the time deltas. This method is intended to be called only from UT_PerfMonProfile when it is updating the profile stats.

fpreal UT_PerfMonStats::value ( const UT_StringRef stat_name) const

This method will always return the value over all threads and frames.

Return the value of the given stat. Return -1.0 if the stat does not exist. Always call hasStat() before value().

fpreal UT_PerfMonStats::value ( const char *  stat_name,
int  first_frame,
int  last_frame,
int  thread_id = UT_PERFMON_STAT_WALL_TIME 
) const

This method returns the values over the given frame range and thread id.

fpreal UT_PerfMonStats::valueForThread ( const char *  stat_name,
int  thread_id 
) const

Sum the value for the given stat name and thread id for ALL frames.


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