MProfilingScope Class Reference

#include <MProfiler.h>

Class Description

MProfilingScope is used to profile code execution time.

Profiling begins with the creation of an MProfilingScope instance and ends when the instance is destroyed (e.g. when it goes out of scope at the end of the block in which it was declared).

For example, if you want to profile any code snippet, you can instrument it like this:

{
MProfilingScope profilingScope(testCategory, MProfiler::kColorD_L1, "eventName", "eventDescription", associatedNode);
// The code snippet you want to profile.
}

When profilingScope is out of its life scope, the profiling stops.

You can also assign an associated node during the instrumentation, then all the profiling events generated from this instrumentation can benefit from the ability of the profiler view to select an associated dependency node for certain events.

+ Examples:

Public Member Functions

 MProfilingScope (int categoryId, MProfiler::ProfilingColor colorIndex, const char *eventName, const char *description=NULL, const MObject &associatedNode=MObject::kNullObj, MStatus *ReturnStatus=NULL)
 Class constructor. More...
 
 ~MProfilingScope ()
 Class destructor. More...
 

Static Public Member Functions

static const char * className ()
 Returns the name of this class. More...
 

Constructor & Destructor Documentation

MProfilingScope ( int  categoryId,
MProfiler::ProfilingColor  colorIndex,
const char *  eventName,
const char *  description = NULL,
const MObject associatedNode = MObject::kNullObj,
MStatus ReturnStatus = NULL 
)

Class constructor.

It begins the profiling.

Parameters
[in]categoryIdThe index of the category which the event belongs to.
[in]colorIndexThe color to draw the profiling result in Profiler Window.
[in]eventNameThe name of the event.
[in]descriptionDescription of the event.
[in]associatedNodeThe dependency node associated with the event.
[out]ReturnStatusStatus code.
Status Codes:
  • MS::kSuccess The MProfilingScope was constructed successfully.
  • MS::kInvalidParameter An invalid object was given. The object has to be a dependency node.

Class destructor.

It ends the profiling.

Member Function Documentation

const char * className ( )
static

Returns the name of this class.

Returns
The name of this class.

The documentation for this class was generated from the following files:
  • MProfiler.h
  • MProfiler.cpp