Profiler Class Reference

#include <profiler.h>

详细描述

Internal .

公共成员函数

MAXON_METHOD UInt32   GetSampleCount ()
MAXON_METHOD void  重置 ()
MAXON_METHOD Bool   GetDebugDumpEnabled ()
MAXON_METHOD void  SetDebugDumpEnabled ( Bool state)
MAXON_METHOD PROFILER_STATE   GetEnableState ()
MAXON_METHOD void  SetEnableState ( PROFILER_STATE state)
MAXON_METHOD Bool   GetEnableState (const ProfilingPoint &profilingPoint)
MAXON_METHOD void  GetMacroTime ()
MAXON_METHOD Bool   IsFirstTime (const ProfilingPoint &profilingPoint)
MAXON_METHOD void  AddSample (const ProfilingPoint &profilingPoint)
MAXON_METHOD void  AddPointSample (const ProfilingPoint &profilingPoint, const Char *outputString=nullptr)
MAXON_METHOD void  AddPointSample (const ProfilingPoint &profilingPoint, const String &outputString)
MAXON_METHOD void  OutputString ( String &string)
MAXON_METHOD void  OutputStringReport (const String &headerString)
MAXON_METHOD PROFILER_CLOCK_MODE   GetClockMode ()
MAXON_METHOD void  SetClockMode ( PROFILER_CLOCK_MODE clockMode)
MAXON_METHOD void  SetClock ( TimeValue timeValue)
MAXON_METHOD void  SetClockMilliseconds ( UInt32 milliseconds)
MAXON_METHOD UInt32   GetClockSampleProcessTime ()
MAXON_METHOD void  SetClockSampleProcessTime ( UInt32 milliseconds)
MAXON_METHOD UInt32   GetClockAutoIncrementTime ()
MAXON_METHOD void  SetClockAutoIncrementTime ( UInt32 milliseconds)
MAXON_METHOD void  AddClock ( TimeValue timeValue)
MAXON_METHOD void  AddClockMilliseconds ( UInt32 milliseconds)
MAXON_METHOD UInt32   GetTimeFilter ()
MAXON_METHOD void  SetTimeFilter ( UInt32 threshold)
MAXON_METHOD void  GetLock ()
MAXON_METHOD void  ReleaseLock ()

静态公共成员函数

static const Profiler NullValueRef ()

私有成员函数

  MAXON_INTERFACE_NONVIRTUAL ( Profiler , MAXON_REFERENCE_NONE , "net.maxon.interface.profiler")

成员函数文档编制

◆  MAXON_INTERFACE_NONVIRTUAL()

MAXON_INTERFACE_NONVIRTUAL ( Profiler   ,
MAXON_REFERENCE_NONE   ,
"net.maxon.interface.profiler"   
)
private

◆  NullValueRef()

static const Profiler & NullValueRef ( )
static

◆  GetSampleCount()

MAXON_METHOD UInt32 GetSampleCount ( )

Gets the count of captured samples.

返回
Captured sample count.

◆  Reset()

MAXON_METHOD void Reset ( )

Resets the profiler.

◆  GetDebugDumpEnabled()

MAXON_METHOD Bool GetDebugDumpEnabled ( )

Gets the profiler debug dump enabled state.

返回
True if enabled, false otherwise.

◆  SetDebugDumpEnabled()

MAXON_METHOD void SetDebugDumpEnabled ( Bool   state )

Sets the profiler debug dump enabled state.

参数
[in] state True if enabled, false otherwise.

◆  GetEnableState() [1/2]

MAXON_METHOD PROFILER_STATE GetEnableState ( )

Gets the profiler state.

返回
State: DISABLED, ENABLED_METHOD_SCOPE, ENABLED_ALL

◆  SetEnableState()

MAXON_METHOD void SetEnableState ( PROFILER_STATE   state )

Sets the profiler state.

参数
[in] state State: DISABLED, ENABLED_METHOD_SCOPE, ENABLED_ALL

◆  GetEnableState() [2/2]

MAXON_METHOD Bool GetEnableState ( const ProfilingPoint profilingPoint )

Gets the enabled state of a profiling point.

返回
True if enabled.

◆  GetMacroTime()

MAXON_METHOD void GetMacroTime ( )

Gets the current time. Used by the calling macro to capture the time before arguments for the call to AddPointSample or AddSample methods are evaluated.

◆  IsFirstTime()

MAXON_METHOD Bool IsFirstTime ( const ProfilingPoint profilingPoint )

Indicates if a profiling point is visited for the first time in the current scope.

参数
[in] profilingPoint ProfilingPoint reference.
返回
True or false.

◆  AddSample()

MAXON_METHOD void AddSample ( const ProfilingPoint profilingPoint )

Adds a sample to a profiling point in the current scope.

A profiling point may be visited multiple times during execution, e.g. within a loop. Every encounter records a time measurement sample, which is added to the scope point, and is used to calculate the total and average time for all captured samples. Points of METHOD_ENTER or SCOPE_ENTER types capture the total scope time for every sample, allowing to report the average scope time as well.

参数
[in] profilingPoint ProfilingPoint reference.

◆  AddPointSample() [1/2]

MAXON_METHOD void AddPointSample ( const ProfilingPoint profilingPoint ,
const Char outputString = nullptr  
)

Adds a profiling point to the current scope and registers a sample.

A profiling point is declared by using a PROFILER macro with an optional output string to be printed with the trace report. If present, the string is recorded the first time a profiling point is visited per scope.

The following example gets the global profiler, configures it to use a simulated clock (to force the captured time values to be constant) and defines profiling points to run the following sequence:

ME 5ms SE loop5x{ 10ms D } 5ms SL ML

where:

static void MyMethod() { maxon::Profiler & profiler = *maxon::ProfilerInstance();

// capture all profiling point types profiler. SetEnableState ( maxon::PROFILER_STATE::ENABLED_ALL );

// use simulated clock profiler. SetClockMode ( maxon::PROFILER_CLOCK_MODE::SIMULATED );

// set sample processing simulated time (in milliseconds) profiler. SetClockSampleProcessTime (5);

// set the time filtering threshold profiler. SetTimeFilter (0); PROFILER_METHOD (); profiler. AddClockMilliseconds (5); PROFILER_SCOPE_ENTER ( "Number of loops: 5" _s); for ( Int32 index = 0; index < 5; index++) { profiler. AddClockMilliseconds (10); PROFILER_DELTA (); } profiler. AddClockMilliseconds (5); PROFILER_SCOPE_LEAVE (); profiler. OutputStringReport ( "MyMethod - Profile trace dump" _s); }

Produces the following output:

MyMethod - Profile trace dump (8 samples in 4 points) [>] 60.0 ms (100.00%), 0.00 ns (0.00% profiler) : METHOD_ENTER: MyMethod (line 304) [0] 5.0 ms (8.33%) [0] 55.0 ms (91.67%), 80.00 ms (31.25% profiler): SCOPE_ENTER: MyMethod (line 308) - Number of loops: 5 [1] 50.0 ms (90.91%) avg: 10.0 ms (5 samples): DELTA: MyMethod (line 314) [1] 5.0 ms (9.09%): SCOPE_LEAVE: MyMethod (line 319)

参数
[in] profilingPoint ProfilingPoint reference.
[in] outputString Optional string to be printed when outputting a report.

◆  AddPointSample() [2/2]

MAXON_METHOD void AddPointSample ( const ProfilingPoint profilingPoint ,
const String outputString  
)

◆  OutputString()

MAXON_METHOD void OutputString ( String string )

Outputs a string to the debugger output and the C4D console profiler logger.

参数
[in] string String to output.

◆  OutputStringReport()

MAXON_METHOD void OutputStringReport ( const String headerString )

Outputs a profiling trace to the debugger output and the C4D console profiler logger.

参数
[in] headerString Header string to output first.

◆  GetClockMode()

MAXON_METHOD PROFILER_CLOCK_MODE GetClockMode ( )

Gets the profiler clock mode.

返回
State: NORMAL, SIMULATED

◆  SetClockMode()

MAXON_METHOD void SetClockMode ( PROFILER_CLOCK_MODE   clockMode )

Sets the profiler clock mode.

参数
[in] clockMode State: NORMAL, SIMULATED

◆  SetClock()

MAXON_METHOD void SetClock ( TimeValue   timeValue )

Sets the profiler simulated clock time value.

◆  SetClockMilliseconds()

MAXON_METHOD void SetClockMilliseconds ( UInt32   milliseconds )

Sets the profiler simulated clock to a time value in milliseconds.

◆  GetClockSampleProcessTime()

MAXON_METHOD UInt32 GetClockSampleProcessTime ( )

Gets the profiler simulated clock time to process a sample in milliseconds.

返回
Sample process time

◆  SetClockSampleProcessTime()

MAXON_METHOD void SetClockSampleProcessTime ( UInt32   milliseconds )

Sets the profiler simulated clock time to process a sample.

◆  GetClockAutoIncrementTime()

MAXON_METHOD UInt32 GetClockAutoIncrementTime ( )

Gets the profiler simulated clock automatic time increment.

返回
Clock automatic time increment value

◆  SetClockAutoIncrementTime()

MAXON_METHOD void SetClockAutoIncrementTime ( UInt32   milliseconds )

Sets the profiler simulated clock automatic time increment.

◆  AddClock()

MAXON_METHOD void AddClock ( TimeValue   timeValue )

Adds a time value to the profiler simulated clock.

◆  AddClockMilliseconds()

MAXON_METHOD void AddClockMilliseconds ( UInt32   milliseconds )

Adds a time delta in milliseconds to the profiler simulated clock.

◆  GetTimeFilter()

MAXON_METHOD UInt32 GetTimeFilter ( )

Gets the time filter threshold value in milliseconds.

返回
Time filter threshold value.

◆  SetTimeFilter()

MAXON_METHOD void SetTimeFilter ( UInt32   threshold )

Sets the time filter threshold value in milliseconds.

参数
[in] threshold State.

◆  GetLock()

MAXON_METHOD void GetLock ( )

Get a lock on the profiler.

◆  ReleaseLock()

MAXON_METHOD void ReleaseLock ( )

Releases a lock on the profiler.

PROFILER_SCOPE_LEAVE
#define PROFILER_SCOPE_LEAVE(...)
定义: profiler.h:423
maxon::Profiler::SetClockSampleProcessTime
MAXON_METHOD void SetClockSampleProcessTime(UInt32 milliseconds)
Sets the profiler simulated clock time to process a sample.
PROFILER_SCOPE_ENTER
#define PROFILER_SCOPE_ENTER(...)
定义: profiler.h:422
maxon::PROFILER_STATE::ENABLED_ALL
@ ENABLED_ALL
Enabled for all point types.
maxon::PROFILER_CLOCK_MODE::SIMULATED
@ SIMULATED
Use a simulated clock for profiling purpose.
maxon::Profiler::SetEnableState
MAXON_METHOD void SetEnableState(PROFILER_STATE state)
maxon::Profiler::AddClockMilliseconds
MAXON_METHOD void AddClockMilliseconds(UInt32 milliseconds)
Adds a time delta in milliseconds to the profiler simulated clock.
maxon::Profiler::SetTimeFilter
MAXON_METHOD void SetTimeFilter(UInt32 threshold)
maxon::Profiler::SetClockMode
MAXON_METHOD void SetClockMode(PROFILER_CLOCK_MODE clockMode)
maxon::Profiler
Internal.
定义: profiler.h:59
PROFILER_DELTA
#define PROFILER_DELTA(...)
定义: profiler.h:424
Int32
maxon::Int32 Int32
定义: ge_sys_math.h:58
maxon::Profiler::OutputStringReport
MAXON_METHOD void OutputStringReport(const String &headerString)
PROFILER_METHOD
#define PROFILER_METHOD(...)
定义: profiler.h:427