Namespace: dmProfile
Language: C++
Type: Defold C++
File: profile.h
Source: engine/dlib/src/dmsdk/dlib/profile.h
Include: dmsdk/dlib/profile.h
Profiling macros
Type: MACRO Adds a profiling scope. Excluded by default in release builds.
Parameters
a (const char*) - A name for the scopeExamples
Profile a scope
{
DM_PROFILE("DoWork");
DoWork1();
DoWork2();
}
Type: MACRO Adds a profiling scope. Excluded by default in release builds. Accepts a name cache value for performance.
Parameters
a (const char*) - The scope namea (uint64_t*) - The scope name hash value pointer. May be 0.Examples
Create a dynamic profiling scope
{
DM_PROFILE_DYN(work->m_Name, &work->m_NameHash);
work->DoWork();
}
Type: MACRO Send text to the profiler
Notes
Parameters
a (const char*) - The format stringa (va_list) - The variable argument listExamples
Send a string to the profiler
DM_PROFILE_TEXT("Some value: %d", value);
Type: MACRO Add a value to float property
Parameters
name (symbol) - The propertyvalue (float) - The valueExamples
DM_PROPERTY_ADD_F32(rmtp_MyValue, 1.5);
Type: MACRO Add a value to double property
Parameters
name (symbol) - The propertyvalue (double) - The valueExamples
DM_PROPERTY_ADD_F64(rmtp_MyValue, 1.5);
Type: MACRO Add a value to int32_t property
Parameters
name (symbol) - The propertyvalue (int32_t) - The valueExamples
DM_PROPERTY_ADD_S32(rmtp_MyValue, -1);
Type: MACRO Add a value to int64_t property
Parameters
name (symbol) - The propertyvalue (int64_t) - The valueExamples
DM_PROPERTY_ADD_S64(rmtp_MyValue, -1);
Type: MACRO Add a value to uint32_t property
Parameters
name (symbol) - The propertyvalue (uint32_t) - The valueExamples
DM_PROPERTY_ADD_U32(rmtp_MyValue, 1);
Type: MACRO Add a value to uint64_t property
Parameters
name (symbol) - The propertyvalue (uint64_t) - The valueExamples
DM_PROPERTY_ADD_U64(rmtp_MyValue, 1);
Type: MACRO Declare a property of type bool
Parameters
name (symbol) - The property symbol/namedefault (bool) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_BOOL(rmtp_MyBool, 0, PROFILE_PROPERTY_FRAME_RESET, "true or false", &rmtp_MyGroup);
Type: MACRO Declare an extern property
Parameters
name (symbol) - The symbol nameExamples
Use a property declared elsewhere in the same library
DM_PROPERTY_EXTERN(rmtp_GameObject);
DM_PROPERTY_U32(rmtp_ComponentsAnim, 0, PROFILE_PROPERTY_FRAME_RESET, "#", &rmtp_GameObject);
Type: MACRO Declare a property of type float
Parameters
name (symbol) - The property symbol/namedefault (float) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_F32(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);
Type: MACRO Declare a property of type double
Parameters
name (symbol) - The property symbol/namedefault (double) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_F64(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);
Type: MACRO Declare a property group
Parameters
name (symbol) - The group namedesc (const char*) - The descriptionparent (ProfileIdx*) - pointer to parent propertyExamples
DM_PROPERTY_GROUP(rmtp_GameObject, "My Group", 0);
Type: MACRO Reset a property to its default value
Parameters
name (symbol) - The propertyExamples
DM_PROPERTY_RESET(rmtp_MyValue);
Type: MACRO Declare a property of type int32_t
Parameters
name (symbol) - The property symbol/namedefault (int32_t) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_S32(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);
Type: MACRO Declare a property of type int64_t
Parameters
name (symbol) - The property symbol/namedefault (int64_t) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_S64(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);
Type: MACRO Set the value of a bool property
Parameters
name (symbol) - The propertyvalue (bool) - The valueExamples
DM_PROPERTY_SET_BOOL(rmtp_MyBool, false);
Type: MACRO Set the value of a float property
Parameters
name (symbol) - The propertyvalue (float) - The valueExamples
DM_PROPERTY_SET_F32(rmtp_MyValue, 1.5);
Type: MACRO Set the value of a double property
Parameters
name (symbol) - The propertyvalue (double) - The valueExamples
DM_PROPERTY_SET_F64(rmtp_MyValue, 1.5);
Type: MACRO Set the value of a int32_t property
Parameters
name (symbol) - The propertyvalue (int32_t) - The valueExamples
DM_PROPERTY_SET_S32(rmtp_MyValue, -1);
Type: MACRO Set the value of a int64_t property
Parameters
name (symbol) - The propertyvalue (int64_t) - The valueExamples
DM_PROPERTY_SET_S64(rmtp_MyValue, -1);
Type: MACRO Set the value of a uint32_t property
Parameters
name (symbol) - The propertyvalue (uint32_t) - The valueExamples
DM_PROPERTY_SET_U32(rmtp_MyValue, 1);
Type: MACRO Set the value of a uint64_t property
Parameters
name (symbol) - The propertyvalue (uint64_t) - The valueExamples
DM_PROPERTY_SET_U64(rmtp_MyValue, 1);
Type: MACRO Declare a property of type uint32_t
Parameters
name (symbol) - The property symbol/namedefault (uint32_t) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_U32(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);
Type: MACRO Declare a property of type uint64_t
Parameters
name (symbol) - The property symbol/namedefault (uint64_t) - The default valueflags (uint32_t) - The flags. Either PROFILE_PROPERTY_NONE or PROFILE_PROPERTY_FRAME_RESET. PROFILE_PROPERTY_FRAME_RESET makes the value reset each frame.desc (const char*) - The descriptiongroup (ProfileIdx*) - The parent group. May be 0.Examples
DM_PROPERTY_U64(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);
Type: TYPEDEF Handle to a an active profile frame
Type: ENUM Index constant to mark a a property as invalid
Type: FUNCTION Finalize the profiling system
Type: FUNCTION Begin profiling, eg start of frame
Notes
Returns
context (HProfile) - The current profiling context. Must be released by #EndFrameType: FUNCTION Release profile returned by #ProfileFrameBegin
Parameters
profile (HProfile) - Profile to releaseType: TYPEDEF Index type to hold internal references of samplers and properties
Type: FUNCTION Initialize the profiling system
Type: FUNCTION Finalize the profiling system
Returns
initialized (bool) - Returns non zero if the profiler is initializedType: STRUCT Structure for registering a profile listener
Type: FUNCTION Log text via the registered profilers
Parameters
name (const char*) - Name of the scope... - Arguments for internal logging functionType: ENUM Set of bit flags to be used when declaring propertis
Members
PROFILE_PROPERTY_NONEPROFILE_PROPERTY_FRAME_RESETType: ENUM Enum to describe type of a property
Members
PROFILE_PROPERTY_TYPE_GROUPPROFILE_PROPERTY_TYPE_BOOLPROFILE_PROPERTY_TYPE_S32PROFILE_PROPERTY_TYPE_U32PROFILE_PROPERTY_TYPE_F32PROFILE_PROPERTY_TYPE_S64PROFILE_PROPERTY_TYPE_U64PROFILE_PROPERTY_TYPE_F64Type: FUNCTION Union to hold a property value
Type: FUNCTION Register a new profiler. Can be done after the profiling has started.
Parameters
name (const char*) - Name of the profilerType: FUNCTION Start a new profile scope
Parameters
name (const char*) - Name of the scopename_hash (uint64_t) - Hashed name of the scopeType: FUNCTION End the last added scope
Parameters
name (const char*) - Name of the scopename_hash (uint64_t) - Hashed name of the scopeType: FUNCTION Set the current thread name to each registered profiler
Parameters
name (const char*) - Name of the threadType: FUNCTION Unregister a profiler
Parameters
name (const char*) - Name of the profiler