Profile

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

API

DM_PROFILE

Type: MACRO Adds a profiling scope. Excluded by default in release builds.

Parameters

Examples

Profile a scope

{
    DM_PROFILE("DoWork");
    DoWork1();
    DoWork2();
}

DM_PROFILE_DYN

Type: MACRO Adds a profiling scope. Excluded by default in release builds. Accepts a name cache value for performance.

Parameters

Examples

Create a dynamic profiling scope

{
    DM_PROFILE_DYN(work->m_Name, &work->m_NameHash);
    work->DoWork();
}

DM_PROFILE_TEXT

Type: MACRO Send text to the profiler

Notes

Parameters

Examples

Send a string to the profiler

DM_PROFILE_TEXT("Some value: %d", value);

DM_PROPERTY_ADD_F32

Type: MACRO Add a value to float property

Parameters

Examples

DM_PROPERTY_ADD_F32(rmtp_MyValue, 1.5);

DM_PROPERTY_ADD_F64

Type: MACRO Add a value to double property

Parameters

Examples

DM_PROPERTY_ADD_F64(rmtp_MyValue, 1.5);

DM_PROPERTY_ADD_S32

Type: MACRO Add a value to int32_t property

Parameters

Examples

DM_PROPERTY_ADD_S32(rmtp_MyValue, -1);

DM_PROPERTY_ADD_S64

Type: MACRO Add a value to int64_t property

Parameters

Examples

DM_PROPERTY_ADD_S64(rmtp_MyValue, -1);

DM_PROPERTY_ADD_U32

Type: MACRO Add a value to uint32_t property

Parameters

Examples

DM_PROPERTY_ADD_U32(rmtp_MyValue, 1);

DM_PROPERTY_ADD_U64

Type: MACRO Add a value to uint64_t property

Parameters

Examples

DM_PROPERTY_ADD_U64(rmtp_MyValue, 1);

DM_PROPERTY_BOOL

Type: MACRO Declare a property of type bool

Parameters

Examples

DM_PROPERTY_BOOL(rmtp_MyBool, 0, PROFILE_PROPERTY_FRAME_RESET, "true or false", &rmtp_MyGroup);

DM_PROPERTY_EXTERN

Type: MACRO Declare an extern property

Parameters

Examples

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);

DM_PROPERTY_F32

Type: MACRO Declare a property of type float

Parameters

Examples

DM_PROPERTY_F32(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);

DM_PROPERTY_F64

Type: MACRO Declare a property of type double

Parameters

Examples

DM_PROPERTY_F64(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);

DM_PROPERTY_GROUP

Type: MACRO Declare a property group

Parameters

Examples

DM_PROPERTY_GROUP(rmtp_GameObject, "My Group", 0);

DM_PROPERTY_RESET

Type: MACRO Reset a property to its default value

Parameters

Examples

DM_PROPERTY_RESET(rmtp_MyValue);

DM_PROPERTY_S32

Type: MACRO Declare a property of type int32_t

Parameters

Examples

DM_PROPERTY_S32(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);

DM_PROPERTY_S64

Type: MACRO Declare a property of type int64_t

Parameters

Examples

DM_PROPERTY_S64(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);

DM_PROPERTY_SET_BOOL

Type: MACRO Set the value of a bool property

Parameters

Examples

DM_PROPERTY_SET_BOOL(rmtp_MyBool, false);

DM_PROPERTY_SET_F32

Type: MACRO Set the value of a float property

Parameters

Examples

DM_PROPERTY_SET_F32(rmtp_MyValue, 1.5);

DM_PROPERTY_SET_F64

Type: MACRO Set the value of a double property

Parameters

Examples

DM_PROPERTY_SET_F64(rmtp_MyValue, 1.5);

DM_PROPERTY_SET_S32

Type: MACRO Set the value of a int32_t property

Parameters

Examples

DM_PROPERTY_SET_S32(rmtp_MyValue, -1);

DM_PROPERTY_SET_S64

Type: MACRO Set the value of a int64_t property

Parameters

Examples

DM_PROPERTY_SET_S64(rmtp_MyValue, -1);

DM_PROPERTY_SET_U32

Type: MACRO Set the value of a uint32_t property

Parameters

Examples

DM_PROPERTY_SET_U32(rmtp_MyValue, 1);

DM_PROPERTY_SET_U64

Type: MACRO Set the value of a uint64_t property

Parameters

Examples

DM_PROPERTY_SET_U64(rmtp_MyValue, 1);

DM_PROPERTY_U32

Type: MACRO Declare a property of type uint32_t

Parameters

Examples

DM_PROPERTY_U32(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);

DM_PROPERTY_U64

Type: MACRO Declare a property of type uint64_t

Parameters

Examples

DM_PROPERTY_U64(rmtp_MyValue, 0, PROFILE_PROPERTY_FRAME_RESET, "a value", &rmtp_MyGroup);

HProfile

Type: TYPEDEF Handle to a an active profile frame

PROFILE_PROPERTY_INVALID_IDX

Type: ENUM Index constant to mark a a property as invalid

ProfileFinalize

Type: FUNCTION Finalize the profiling system

ProfileFrameBegin

Type: FUNCTION Begin profiling, eg start of frame

Notes

Returns

ProfileFrameEnd

Type: FUNCTION Release profile returned by #ProfileFrameBegin

Parameters

ProfileIdx

Type: TYPEDEF Index type to hold internal references of samplers and properties

ProfileInitialize

Type: FUNCTION Initialize the profiling system

ProfileIsInitialized

Type: FUNCTION Finalize the profiling system

Returns

ProfileListener

Type: STRUCT Structure for registering a profile listener

ProfileLogText

Type: FUNCTION Log text via the registered profilers

Parameters

ProfilePropertyFlags

Type: ENUM Set of bit flags to be used when declaring propertis

Members

ProfilePropertyType

Type: ENUM Enum to describe type of a property

Members

ProfilePropertyValue

Type: FUNCTION Union to hold a property value

ProfileRegisterProfiler

Type: FUNCTION Register a new profiler. Can be done after the profiling has started.

Parameters

ProfileScopeBegin

Type: FUNCTION Start a new profile scope

Parameters

ProfileScopeEnd

Type: FUNCTION End the last added scope

Parameters

ProfileSetThreadName

Type: FUNCTION Set the current thread name to each registered profiler

Parameters

ProfileUnregisterProfiler

Type: FUNCTION Unregister a profiler

Parameters