Dayz 1.25
Dayz Code Explorer by KGB
Загрузка...
Поиск...
Не найдено
Enforce Script profiling API

Структуры данных

class  EnProfiler
 Set of methods for accessing script profiling data. Подробнее...
 

Определения типов

typedef Param2< float, typenameEnProfilerTimeClassPair
 
typedef Param2< int, typenameEnProfilerCountClassPair
 
typedef Param2< float, stringEnProfilerTimeFuncPair
 
typedef Param2< int, stringEnProfilerCountFuncPair
 

Перечисления

enum  EnProfilerFlags { NONE = 0 , RESET , RECURSIVE , ALL }
 Flags that influences the behaviour of the EnProfiler API, applied through ...Flags functions. Подробнее...
 
enum  EnProfilerModule {
  CORE , GAMELIB , GAME , WORLD ,
  MISSION , MISSION_CUSTOM , ERROR
}
 Current base scripted modules. Подробнее...
 
enum  EnProfilerEnabledFlags { NONE = 0 , DIAG , SCRP , SCRC }
 There are 3 states which can be toggled that governs whether script profiling is enabled or not. Подробнее...
 

Функции

static proto void Enable (bool enable, bool immediate=false, bool sessionReset=true)
 Enable the gathering of script profiling data.
 
static proto int IsEnabled ()
 Return if script profiling is enabled.
 
static bool IsEnabledD ()
 Return if script profiling is enabled through [DM].
 
static bool IsEnabledP ()
 Return if script profiling is enabled through EnProfiler.
 
static bool IsEnabledC ()
 Return if script profiling is actually turned on inside of the script context.
 
static proto void SortData ()
 The internal sorting that happens at the end of the frame (so it is NOT necessary to call this manually) to supply Get...Per... functions.
 
static proto void ResetSession (bool fullReset=false)
 Perform [SR], clearing SessionFrame, ProfiledSessionFrames, [SD] and [PD] (except for [CI])
 

EnProfilerFlags

Set of functions to configure the currently active EnProfilerFlags

static proto int SetFlags (int flags, bool sessionReset=true)
 Override the currently used set of EnProfilerFlags across the API.
 
static proto int GetFlags ()
 Get the currently used flags across the API.
 
static proto bool IsFlagsSet (int flags)
 Check if the flags are set.
 
static proto int AddFlags (int flags, bool sessionReset=true)
 Add flags to the currently used set of EnProfilerFlags across the API.
 
static proto int RemoveFlags (int flags, bool sessionReset=true)
 Remove flags from the currently used set of EnProfilerFlags across the API.
 
static proto int ClearFlags (bool sessionReset=true)
 Remove all flags from the currently used set of EnProfilerFlags across the API.
 

EnProfilerModule

Set of functions to configure the currently profiled EnProfilerModule

static proto void SetModule (EnProfilerModule module, bool sessionReset=true)
 Set the module to be profiled.
 
static proto EnProfilerModule GetModule ()
 Get the currently profiled module.
 
static proto owned string ModuleToName (EnProfilerModule module)
 Helper to convert EnProfilerModule to string.
 
static proto bool NameToModule (string moduleName, out EnProfilerModule module)
 Convert string to EnProfilerModule.
 
static proto void SetInterval (int interval, bool sessionReset=true)
 Set the interval for the [SD] to update.
 
static proto int GetInterval ()
 Get the currently set interval.
 
static proto void SetTimeResolution (int resolution)
 Set the resolution of the fetched Time data.
 
static proto int GetTimeResolution ()
 Get the currently set time resolution.
 
static proto void EnableAverage (bool enable)
 Enable/disable returning calculated averages.
 
static proto bool IsAverage ()
 Check if returning of average data is enabled.
 
static proto void Dump ()
 Print out [SD] to script log.
 

Frame data

Set of functions to obtain information about frame counts

static proto int GetGameFrame ()
 Get the total amount of frames passed.
 
static proto int GetSessionFrame ()
 Get the total amount of frames in this profiling session.
 
static proto int GetTotalFrames ()
 Get the total amount of frames across all profiling session.
 
static proto int GetProfiledSessionFrames ()
 Get the total amount of frames profiled in this profiling session.
 
static proto int GetProfiledFrames ()
 Get the total amount of frames profiled across all profiling session.
 

Sorted data

Set of functions to obtain [SD]

Предупреждения
Data is appended to the array, it will not clear any previous data already existing in the array
Заметки
Read SortData as well for more information regarding [SD]
static proto void GetTimePerClass (notnull out array< ref EnProfilerTimeClassPair > outArr, int count=int.MAX)
 Obtain [SD] for Time Per Class.
 
static proto void GetAllocationsPerClass (notnull out array< ref EnProfilerCountClassPair > outArr, int count=int.MAX)
 Obtain [SD] for Allocations Per Class.
 
static proto void GetInstancesPerClass (notnull out array< ref EnProfilerCountClassPair > outArr, int count=int.MAX)
 Obtain [SD] for Instances Per Class.
 
static proto void GetTimePerFunc (notnull out array< ref EnProfilerTimeFuncPair > outArr, int count=int.MAX)
 Obtain [SD] for Time Per Function.
 
static proto void GetCountPerFunc (notnull out array< ref EnProfilerCountFuncPair > outArr, int count=int.MAX)
 Obtain [SD] for Count Per Function.
 

Specific data

Set of functions to obtain specific data

static proto float GetTimeOfClass (typename clss, bool immediate=false)
 Obtain [SD] or [PD] regarding the time a specific class consumed.
 
static proto int GetAllocationsOfClass (typename clss, bool immediate=false)
 Obtain [SD] or [PD] regarding the allocations of a specific class.
 
static proto int GetInstancesOfClass (typename clss, bool immediate=false)
 Obtain [SD] or [PD] regarding the [CI] of a specific class.
 
static proto float GetTimeOfFunc (string funct, typename clss, bool immediate=false)
 Obtain [SD] or [PD] regarding the time consumed by a specific function.
 
static proto float GetTimeOfFuncG (string funct, bool immediate, bool immediate=false)
 Obtain [SD] or [PD] regarding the time consumed by a specific global function.
 
static proto int GetCountOfFunc (string funct, typename clss, bool immediate=false)
 Obtain [SD] or [PD] regarding the amount of times a specific function was called.
 
static proto int GetCountOfFuncG (string funct, bool immediate=false)
 Obtain [SD] or [PD] regarding the amount of times a specific function was called.
 

Misc

Set of helper functions

static bool RequestImmediateData ()
 Helper method to ascertain the profiler will record [PD] right after this call.
 

Подробное описание

Предупреждения
Only available on developer and diag builds

Типы

◆ EnProfilerCountClassPair

◆ EnProfilerCountFuncPair

◆ EnProfilerTimeClassPair

◆ EnProfilerTimeFuncPair

Перечисления

◆ EnProfilerEnabledFlags

There are 3 states which can be toggled that governs whether script profiling is enabled or not.

Заметки
The reason for this is because when it is enabled in debug menu, or through this API without 'immediate', it will only be enabled the next frame
Элементы перечислений
NONE 

No flags.

No automatic destroying.

Flags to pass to ParticleSource.StopParticle.

Plain Effect base.

No flags, has value 0, so will count as false in conditions.

No flags

DIAG 

Script profiling UI is enabled in WIN+ALT debug menu, when this is true, it will override SCRP.

SCRP 

It has been set to being always enabled through EnProfiler (SCRipt Profiler)

SCRC 

Whether profiling is currently truly happening (SCRipt Context)

44{
46 NONE,
48 DIAG,
50 SCRP,
52 SCRC,
53};
@ DIAG
Script profiling UI is enabled in WIN+ALT debug menu, when this is true, it will override SCRP.
Definition EnProfiler.c:48
@ SCRP
It has been set to being always enabled through EnProfiler (SCRipt Profiler)
Definition EnProfiler.c:50
@ NONE
No flags.
Definition EnProfiler.c:11
@ SCRC
Whether profiling is currently truly happening (SCRipt Context)
Definition EnProfiler.c:52

◆ EnProfilerFlags

Flags that influences the behaviour of the EnProfiler API, applied through ...Flags functions.

Элементы перечислений
NONE 

No flags.

No automatic destroying.

Flags to pass to ParticleSource.StopParticle.

Plain Effect base.

No flags, has value 0, so will count as false in conditions.

No flags

RESET 

When present, will reset [PD] on sorting, otherwise will accumulate on top of it.

RECURSIVE 

Whether to profile child modules.

ALL 

All flags enabled.

9{
11 NONE,
13 RESET,
17 ALL
18};
@ RECURSIVE
Whether to profile child modules.
Definition EnProfiler.c:15
@ RESET
When present, will reset [PD] on sorting, otherwise will accumulate on top of it.
Definition EnProfiler.c:13
@ ALL
All flags enabled.
Definition EnProfiler.c:17

◆ EnProfilerModule

Current base scripted modules.

Элементы перечислений
CORE 

1_Core

GAMELIB 

2_GameLib

GAME 

3_Game

WORLD 

4_World

MISSION 

5_Mission

MISSION_CUSTOM 

init.c

ERROR 

Can be returned from some methods.

22{
24 CORE,
26 GAMELIB,
28 GAME,
30 WORLD,
32 MISSION,
36 ERROR,
37};
@ ERROR
Can be returned from some methods.
Definition EnProfiler.c:36
@ WORLD
4_World
Definition EnProfiler.c:30
@ CORE
1_Core
Definition EnProfiler.c:24
@ GAMELIB
2_GameLib
Definition EnProfiler.c:26
@ MISSION_CUSTOM
init.c
Definition EnProfiler.c:34
@ GAME
3_Game
Definition EnProfiler.c:28
@ MISSION
5_Mission
Definition EnProfiler.c:32

Функции

◆ AddFlags()

static proto int AddFlags ( int flags,
bool sessionReset = true )
staticprivate

Add flags to the currently used set of EnProfilerFlags across the API.

Заметки
Simply a helper method to quickly add EnProfilerFlags
Аргументы
flagsint The combination of desired EnProfilerFlags to be added to the currently used set
sessionResetbool When set to false, no [SR] will trigger, regardless of situation
Возвращает
int The currently used set of EnProfilerFlags after the function call
// In the case where the current set of EnProfilerFlags is EnProfilerFlags.RESET
// The resulting set of flags now will be EnProfilerFlags.RESET | EnProfilerFlags.RECURSIVE
// As the above is pretty much the same as the following
// EnProfiler.SetFlags(EnProfiler.GetFlags() | EnProfilerFlags.RECURSIVE);
// But a much cleaner and faster alternative (bitwise operations in script is ~10x slower than C++)
Set of methods for accessing script profiling data.
Definition EnProfiler.c:73
static proto int AddFlags(int flags, bool sessionReset=true)
Add flags to the currently used set of EnProfilerFlags across the API.
EnProfilerFlags
Flags that influences the behaviour of the EnProfiler API, applied through ...Flags functions.
Definition EnProfiler.c:9

Используется в EnProfilerTests::TestAddFlags().

◆ ClearFlags()

static proto int ClearFlags ( bool sessionReset = true)
staticprivate

Remove all flags from the currently used set of EnProfilerFlags across the API.

Заметки
Simply a helper method to quickly remove all EnProfilerFlags
Аргументы
sessionResetbool When set to false, no [SR] will trigger, regardless of situation
Возвращает
int The currently used set of EnProfilerFlags after the function call
// In the case where the current set of EnProfilerFlags is EnProfilerFlags.RESET
// The resulting set of flags now will be EnProfilerFlags.NONE
// As the above is pretty much the same as the following
// EnProfiler.SetFlags(EnProfilerFlags.NONE);
// But a much cleaner and implicit alternative
static proto int ClearFlags(bool sessionReset=true)
Remove all flags from the currently used set of EnProfilerFlags across the API.

Используется в EnProfilerTests::TestAddFlags() и EnProfilerTests::TestClearFlags().

◆ Dump()

static proto void Dump ( )
staticprivate

Print out [SD] to script log.

static proto void Dump()
Print out [SD] to script log.

◆ Enable()

static proto void Enable ( bool enable,
bool immediate = false,
bool sessionReset = true )
staticprivate

Enable the gathering of script profiling data.

Заметки
DEFAULT: disabled (unless launched with "-profile", then it is default enabled)
This is separate from the one in [DM], so toggling it in [DM] will not affect this, and toggling it here will not affect [DM]
It will ignore the call if trying to set the current state, except when "immediate" is used
Аргументы
enablebool Whether to enable or disable, if it was previously not enabled, it will cause [SR]
Заметки
Disabling does not cause [SR], so all data will stay intact
Аргументы
immediatebool When true will instantly start/stop profiling, otherwise it will apply it at the end of the frame (to have one stable point in time)
Предупреждения
Keep in mind that when using immediate, it will not be the data of the entire frame, which can skew data if not kept in mind
Аргументы
sessionResetbool When set to false, no [SR] will trigger, regardless of situation
// Simple enable, will start profiling the next frame
// Will cause [SR] if !IsEnabledP() before this call
// Immediate enable, will start profiling immediately
// Will cause [SR] if !IsEnabledP() before this call
EnProfiler.Enable(true, true);
// Immediate disable, will stop profiling immediately
// Disabling will never cause [SR], preserving data
EnProfiler.Enable(false, true);
// Simple disable, will not profile the next frame (but still finish profiling the current one)
// Disabling will never cause [SR], preserving data
static proto void Enable(bool enable, bool immediate=false, bool sessionReset=true)
Enable the gathering of script profiling data.

Используется в EnProfiler::RequestImmediateData(), EnProfilerTests::TestClassCountData(), EnProfilerTests::TestClassTimeData(), EnProfilerTests::TestFuncCountData(), EnProfilerTests::TestFuncTimeData(), EnProfilerTests::TestModule(), EnProfilerTests::TestToggling(), EnProfilerTests::TestTogglingImmediate() и EnProfilerTests::~EnProfilerTests().

◆ EnableAverage()

static proto void EnableAverage ( bool enable)
staticprivate

Enable/disable returning calculated averages.

Заметки
DEFAULT: false
When EnProfilerFlags.RESET flag is not present, it will divide by the session frame
When an interval is set, it will divide by the interval
Does not affect any data itself, only the fetching and displaying of it (therefore, no [SR] is ever triggered by this method)
[CI] will never be an average, it will always be the current count of the instance (allocations will be the value of how many times an instance is created)
Аргументы
enablebool Whether to enable or disable
// For example, take the situation where we only reset every 60 frames
// And a method is called once per frame, gathering the count of that function will be 1
// Or if a method is called twice per frame, gathering the count of that function will be 2
// Or if a method is 3 times every 3 frames, gathering the count of that function will be 1
// ...
// So you get the average amount of times the method is called per frame, out of the sample of 60 frames
static proto void EnableAverage(bool enable)
Enable/disable returning calculated averages.
static proto void SetInterval(int interval, bool sessionReset=true)
Set the interval for the [SD] to update.

◆ GetAllocationsOfClass()

static proto int GetAllocationsOfClass ( typename clss ,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the allocations of a specific class.

Аргументы
clsstypename Typename of desired class
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
int Allocations of the specified class
Definition EntityAI.c:95
static proto int GetAllocationsOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the allocations of a specific class.

Используется в EnProfilerTests::TestClassCountData().

◆ GetAllocationsPerClass()

static proto void GetAllocationsPerClass ( notnull out array< ref EnProfilerCountClassPair > outArr,
int count = int.MAX )
staticprivate

Obtain [SD] for Allocations Per Class.

Аргументы
outArrarray<ref EnProfilerCountClassPair> Array sorted by number of allocations of a class
countint The maximum amount of entries wanted
static proto void GetAllocationsPerClass(notnull out array< ref EnProfilerCountClassPair > outArr, int count=int.MAX)
Obtain [SD] for Allocations Per Class.

◆ GetCountOfFunc()

static proto int GetCountOfFunc ( string funct,
typename clss ,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the amount of times a specific function was called.

Аргументы
functstring Function name
clsstypename Typename of class the function belongs to
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
int Amount of calls to the specified function or -1 when function was not found
int callCountOfFunc = EnProfiler.GetCountOfFunc("StringFormat", StaticGetType(EnProfilerTests), true);
Definition EnProfilerTests.c:2
static proto int GetCountOfFunc(string funct, typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the amount of times a specific function was called.

Используется в EnProfilerTests::TestFuncCountData().

◆ GetCountOfFuncG()

static proto int GetCountOfFuncG ( string funct,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the amount of times a specific function was called.

Аргументы
functstring Function name
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
int Amount of calls to the specified function or -1 when function was not found
static proto int GetCountOfFuncG(string funct, bool immediate=false)
Obtain [SD] or [PD] regarding the amount of times a specific function was called.

Используется в EnProfilerTests::TestFuncCountData().

◆ GetCountPerFunc()

static proto void GetCountPerFunc ( notnull out array< ref EnProfilerCountFuncPair > outArr,
int count = int.MAX )
staticprivate

Obtain [SD] for Count Per Function.

Аргументы
outArrarray<ref EnProfilerCountFuncPair> Array sorted by amount of times a function was called
countint The maximum amount of entries wanted
static proto void GetCountPerFunc(notnull out array< ref EnProfilerCountFuncPair > outArr, int count=int.MAX)
Obtain [SD] for Count Per Function.

◆ GetFlags()

static proto int GetFlags ( )
staticprivate

Get the currently used flags across the API.

Возвращает
int The currently used set of EnProfilerFlags
int flags = EnProfiler.GetFlags();
if (flags & EnProfilerFlags.RECURSIVE)
{
Print("Currently profiling all modules.");
}
proto void Print(void var)
Prints content of variable to console/log.
static proto int GetFlags()
Get the currently used flags across the API.

Используется в EnProfilerTests::TestAddFlags(), EnProfilerTests::TestClearFlags(), EnProfilerTests::TestModule() и EnProfilerTests::TestSetFlags().

◆ GetGameFrame()

static proto int GetGameFrame ( )
staticprivate

Get the total amount of frames passed.

Возвращает
int The total amount of frames passed
static proto int GetGameFrame()
Get the total amount of frames passed.

◆ GetInstancesOfClass()

static proto int GetInstancesOfClass ( typename clss ,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the [CI] of a specific class.

Аргументы
clsstypename Typename of desired class
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
int [CI] of the specified class
static proto int GetInstancesOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the [CI] of a specific class.

Используется в EnProfilerTests::TestClassCountData().

◆ GetInstancesPerClass()

static proto void GetInstancesPerClass ( notnull out array< ref EnProfilerCountClassPair > outArr,
int count = int.MAX )
staticprivate

Obtain [SD] for Instances Per Class.

Аргументы
outArrarray<ref EnProfilerCountClassPair> Array sorted by number of instances of a class
countint The maximum amount of entries wanted
static proto void GetInstancesPerClass(notnull out array< ref EnProfilerCountClassPair > outArr, int count=int.MAX)
Obtain [SD] for Instances Per Class.

◆ GetInterval()

static proto int GetInterval ( )
staticprivate

Get the currently set interval.

Возвращает
int The currently set interval
static proto int GetInterval()
Get the currently set interval.

◆ GetModule()

static proto EnProfilerModule GetModule ( )
staticprivate

Get the currently profiled module.

Возвращает
EnProfilerModule The currently profiled module
EnProfilerModule module = EnProfiler.GetModule();
EnProfilerModule
Current base scripted modules.
Definition EnProfiler.c:22

Используется в EnProfilerTests::TestModule().

◆ GetProfiledFrames()

static proto int GetProfiledFrames ( )
staticprivate

Get the total amount of frames profiled across all profiling session.

Заметки
This will only differ from GetTotalFrames when there was an Interval set at some point
Возвращает
int The total amount of frames profiled across all profiling session
static proto int GetProfiledFrames()
Get the total amount of frames profiled across all profiling session.

◆ GetProfiledSessionFrames()

static proto int GetProfiledSessionFrames ( )
staticprivate

Get the total amount of frames profiled in this profiling session.

Заметки
This will only differ from GetSessionFrame when there is an Interval set
Возвращает
int The total amount of frames profiled in this profiling session
static proto int GetProfiledSessionFrames()
Get the total amount of frames profiled in this profiling session.

◆ GetSessionFrame()

static proto int GetSessionFrame ( )
staticprivate

Get the total amount of frames in this profiling session.

Заметки
This will only differ from GetProfiledSessionFrames when there is an Interval set
Возвращает
int The total amount of frames in this profiling session
static proto int GetSessionFrame()
Get the total amount of frames in this profiling session.

◆ GetTimeOfClass()

static proto float GetTimeOfClass ( typename clss ,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the time a specific class consumed.

Аргументы
clsstypename Typename of desired class
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
float Time consumed by the specified class
// Consider the class
// Some functions being called here...
// Gathering of data can be done through
float timeOfClass = EnProfiler.GetTimeOfClass(clss.Type(), true);
// Or when you have no variable/reference
float timeOfClass2 = EnProfiler.GetTimeOfClass(StaticGetType(EPTHelperClass), true);
static proto float GetTimeOfClass(typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the time a specific class consumed.

Используется в EnProfilerTests::TestClassTimeData().

◆ GetTimeOfFunc()

static proto float GetTimeOfFunc ( string funct,
typename clss ,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the time consumed by a specific function.

Аргументы
functstring Function name
clsstypename Typename of class the function belongs to
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
float Time consumed by the specified function or -1 when function was not found
float timeOfFunc = EnProfiler.GetTimeOfFunc("StringFormat", StaticGetType(EnProfilerTests), true);
static proto float GetTimeOfFunc(string funct, typename clss, bool immediate=false)
Obtain [SD] or [PD] regarding the time consumed by a specific function.

Используется в EnProfilerTests::TestFuncTimeData() и EnProfilerTests::TestModule().

◆ GetTimeOfFuncG()

static proto float GetTimeOfFuncG ( string funct,
bool immediate,
bool immediate = false )
staticprivate

Obtain [SD] or [PD] regarding the time consumed by a specific global function.

Аргументы
functstring Function name
immediatebool When true, it will pull from [SD], when false it will pull from [PD]
Возвращает
float Time consumed by the specified function or -1 when function was not found
float timeOfFunc = EnProfiler.GetTimeOfFuncG("ErrorEx", true);
static proto float GetTimeOfFuncG(string funct, bool immediate, bool immediate=false)
Obtain [SD] or [PD] regarding the time consumed by a specific global function.

◆ GetTimePerClass()

static proto void GetTimePerClass ( notnull out array< ref EnProfilerTimeClassPair > outArr,
int count = int.MAX )
staticprivate

Obtain [SD] for Time Per Class.

Аргументы
outArrarray<ref EnProfilerTimeClassPair> Array sorted by time consumed by a class
countint The maximum amount of entries wanted
// In this example the array will be filled with the 20 most time intensive classes
// If there are less than 20 classes which consumed time, it will output that number of classes instead
// In this example the array will be filled with all classes sorted by time
static proto void GetTimePerClass(notnull out array< ref EnProfilerTimeClassPair > outArr, int count=int.MAX)
Obtain [SD] for Time Per Class.

Используется в EnProfilerTests::TestModule().

◆ GetTimePerFunc()

static proto void GetTimePerFunc ( notnull out array< ref EnProfilerTimeFuncPair > outArr,
int count = int.MAX )
staticprivate

Obtain [SD] for Time Per Function.

Аргументы
outArrarray<ref EnProfilerTimeFuncPair> Array sorted by time consumed by a function
countint The maximum amount of entries wanted
static proto void GetTimePerFunc(notnull out array< ref EnProfilerTimeFuncPair > outArr, int count=int.MAX)
Obtain [SD] for Time Per Function.

Используется в EnProfilerTests::TestModule().

◆ GetTimeResolution()

static proto int GetTimeResolution ( )
staticprivate

Get the currently set time resolution.

Возвращает
int The currently set resolution
static proto int GetTimeResolution()
Get the currently set time resolution.

Используется в EnProfilerTests::TestClassTimeData(), EnProfilerTests::TestFuncTimeData() и EnProfilerTests::TestModule().

◆ GetTotalFrames()

static proto int GetTotalFrames ( )
staticprivate

Get the total amount of frames across all profiling session.

Заметки
This will only differ from GetProfiledFrames when there was an Interval set at some point
Возвращает
int The total amount of frames across all profiling session
static proto int GetTotalFrames()
Get the total amount of frames across all profiling session.

◆ IsAverage()

static proto bool IsAverage ( )
staticprivate

Check if returning of average data is enabled.

Возвращает
bool Whether returning of average data is enabled
static proto bool IsAverage()
Check if returning of average data is enabled.

◆ IsEnabled()

static proto int IsEnabled ( )
staticprivate

Return if script profiling is enabled.

Заметки
Helper methods below
Возвращает
int Flags regarding the current state
static proto int IsEnabled()
Return if script profiling is enabled.

Используется в EnProfiler::IsEnabledC(), EnProfiler::IsEnabledD() и EnProfiler::IsEnabledP().

◆ IsEnabledC()

static bool IsEnabledC ( )
inlinestaticprivate

Return if script profiling is actually turned on inside of the script context.

Заметки
When using "-profile" launch parameter, it will enable it through EnProfiler, so this will return true
Возвращает
bool Whether script is being profiled as of this moment
static bool IsEnabledC()
Return if script profiling is actually turned on inside of the script context.
Definition EnProfiler.c:152
153 {
154 return (IsEnabled() & EnProfilerEnabledFlags.SCRC);
155 }
EnProfilerEnabledFlags
There are 3 states which can be toggled that governs whether script profiling is enabled or not.
Definition EnProfiler.c:44

Перекрестные ссылки EnProfiler::IsEnabled().

Используется в EnProfilerTests::EnProfilerTests(), EnProfiler::RequestImmediateData() и EnProfilerTests::TestTogglingImmediate().

◆ IsEnabledD()

static bool IsEnabledD ( )
inlinestaticprivate

Return if script profiling is enabled through [DM].

Возвращает
bool Whether script profiling is enabled through [DM]
static bool IsEnabledD()
Return if script profiling is enabled through [DM].
Definition EnProfiler.c:124
125 {
126 return (IsEnabled() & EnProfilerEnabledFlags.DIAG);
127 }

Перекрестные ссылки EnProfiler::IsEnabled().

◆ IsEnabledP()

static bool IsEnabledP ( )
inlinestaticprivate

Return if script profiling is enabled through EnProfiler.

Заметки
When using "-profile" launch parameter, it will enable it through EnProfiler, so this will return true
Возвращает
bool Whether script profiling is enabled through script profiler
static bool IsEnabledP()
Return if script profiling is enabled through EnProfiler.
Definition EnProfiler.c:138
139 {
140 return (IsEnabled() & EnProfilerEnabledFlags.SCRP);
141 }

Перекрестные ссылки EnProfiler::IsEnabled().

Используется в EnProfilerTests::TestToggling().

◆ IsFlagsSet()

static proto bool IsFlagsSet ( int flags)
staticprivate

Check if the flags are set.

Заметки
Is effectively the same as the code displayed in GetFlags example, but without the bitwise operation
Аргументы
flagsint The combination of EnProfilerFlags to check if present
Возвращает
bool If the flags are set
{
Print("Currently all flags are enabled.");
}
{
Print("Currently profiling all modules.");
}
static proto bool IsFlagsSet(int flags)
Check if the flags are set.

◆ ModuleToName()

static proto owned string ModuleToName ( EnProfilerModule module)
staticprivate

Helper to convert EnProfilerModule to string.

Аргументы
moduleEnProfilerModule The module to get the name of
Возвращает
string The name of the module
static proto owned string ModuleToName(EnProfilerModule module)
Helper to convert EnProfilerModule to string.

◆ NameToModule()

static proto bool NameToModule ( string moduleName,
out EnProfilerModule module )
staticprivate

Convert string to EnProfilerModule.

Аргументы
moduleNamestring The name of the module
moduleEnProfilerModule The enum value of the module or EnProfilerModule.ERROR if not found
Возвращает
bool Whether the module was found
// Get the name of the module of the current class
string nameOfCurrentModule = Type().GetModule();
// Convert it to the enum value
{
}
else
{
ErrorEx(string.Format("Could not find EnProfilerModule: %1", nameOfCurrentModule));
}
string Type
Definition JsonDataContaminatedArea.c:11
enum ShapeType ErrorEx
static proto void SetModule(EnProfilerModule module, bool sessionReset=true)
Set the module to be profiled.
static proto bool NameToModule(string moduleName, out EnProfilerModule module)
Convert string to EnProfilerModule.

Используется в EnProfilerTests::TestModule().

◆ RemoveFlags()

static proto int RemoveFlags ( int flags,
bool sessionReset = true )
staticprivate

Remove flags from the currently used set of EnProfilerFlags across the API.

Заметки
Simply a helper method to quickly remove EnProfilerFlags
Аргументы
flagsint The combination of desired EnProfilerFlags to be added to the currently used set
sessionResetbool When set to false, no [SR] will trigger, regardless of situation
Возвращает
int The currently used set of EnProfilerFlags after the function call
// In the case where the current set of EnProfilerFlags is EnProfilerFlags.RESET
// The resulting set of flags now will be EnProfilerFlags.NONE
// As the above is pretty much the same as the following
// EnProfiler.SetFlags(EnProfiler.GetFlags() & ~EnProfilerFlags.RECURSIVE);
// But a much cleaner and faster alternative (bitwise operations in script is ~10x slower than C++)
static proto int RemoveFlags(int flags, bool sessionReset=true)
Remove flags from the currently used set of EnProfilerFlags across the API.

Используется в EnProfilerTests::TestClearFlags() и EnProfilerTests::TestModule().

◆ RequestImmediateData()

static bool RequestImmediateData ( )
inlinestaticprivate

Helper method to ascertain the profiler will record [PD] right after this call.

Возвращает
bool Whether it was enabled before or not
static bool RequestImmediateData()
Helper method to ascertain the profiler will record [PD] right after this call.
Definition EnProfiler.c:745
746 {
747 // I only care if it is actually profiling right now, so C
748 bool wasEnabled = IsEnabledC();
749
750 if (!wasEnabled)
751 {
752 // I want the data, and I want it now, so immediate
753 Enable(true, true);
754 }
755
756 return wasEnabled;
757 }

Перекрестные ссылки EnProfiler::Enable() и EnProfiler::IsEnabledC().

Используется в EnProfilerTests::TestClassCountData(), EnProfilerTests::TestClassTimeData(), EnProfilerTests::TestFuncCountData(), EnProfilerTests::TestFuncTimeData() и EnProfilerTests::TestModule().

◆ ResetSession()

static proto void ResetSession ( bool fullReset = false)
staticprivate

Perform [SR], clearing SessionFrame, ProfiledSessionFrames, [SD] and [PD] (except for [CI])

Заметки
Can also be triggered by a variety of other functions in this API
When triggered by the other functions, it will call with fullReset = false
Аргументы
fullResetbool Whether to clear [PD] of all modules, when false it will only clear the [PD] according to current settings
// Considering the settings: SetFlags(EnProfilerFlags.NONE) and SetModule(EnProfilerModule.GAME)
// The following call will only clear [PD] of 3_Game
// Considering the settings: SetFlags(EnProfilerFlags.RECURSIVE) and SetModule(EnProfilerModule.WORLD)
// The following call will clear [PD] of 3_Game, 4_World, 5_Mission and their children
// The following call resets [PD] across all modules
static proto void ResetSession(bool fullReset=false)
Perform [SR], clearing SessionFrame, ProfiledSessionFrames, [SD] and [PD] (except for [CI])

Используется в EnProfilerTests::TestModule().

◆ SetFlags()

static proto int SetFlags ( int flags,
bool sessionReset = true )
staticprivate

Override the currently used set of EnProfilerFlags across the API.

Заметки
DEFAULT: EnProfilerFlags.ALL
Аргументы
flagsint The combination of desired EnProfilerFlags to override the currently used set
sessionResetbool When set to false, no [SR] will trigger, regardless of situation
Возвращает
int The currently used set of EnProfilerFlags after the function call
// No RESET flag, [PD] will be accumulated across frames
// No RECURSIVE flag, only the curently profiled module will be sorted
// RESET flag, [PD] will be reset after sorting
// No RECURSIVE flag, only the curently profiled module will be sorted
// RESET flag, [PD] will be reset after sorting
// RECURSIVE flag, all modules will be sorted
static proto int SetFlags(int flags, bool sessionReset=true)
Override the currently used set of EnProfilerFlags across the API.

Используется в EnProfilerTests::TestAddFlags(), EnProfilerTests::TestClearFlags(), EnProfilerTests::TestModule() и EnProfilerTests::TestSetFlags().

◆ SetInterval()

static proto void SetInterval ( int interval,
bool sessionReset = true )
staticprivate

Set the interval for the [SD] to update.

Заметки
DEFAULT: 0
[DM] has the following values: {0, 5, 10, 20, 30, 50, 60, 120, 144}; When an interval not part of this list is set, [DM] will be set to "CUSTOM_INTERVAL"
Does not affect the gathering of [PD], this will happen continuously as the profiling is enabled
This also delays the [SR] caused by EnProfilerFlags.RESET
Аргументы
intervalint Amount of frames to wait before [SD] is updated
sessionResetbool When set to false, no [SR] will trigger, regardless of situation
// This will make it so that [SD] is updated every 60 frames

◆ SetModule()

static proto void SetModule ( EnProfilerModule module,
bool sessionReset = true )
staticprivate

Set the module to be profiled.

Заметки
DEFAULT: EnProfilerModule.CORE
When session reset is enabled, it will only reset the module which it is currently being set to, previous module data will be untouched
Аргументы
moduleEnProfilerModule The module to profile
sessionResetbool When set to false, no [SR] will trigger, regardless of situation

Используется в EnProfilerTests::TestModule().

◆ SetTimeResolution()

static proto void SetTimeResolution ( int resolution)
staticprivate

Set the resolution of the fetched Time data.

Заметки
DEFAULT: 100000
[DM] has the following values: {100000, 1000000, 1, 10, 100, 1000, 10000}; These are the only values available, otherwise it will round up to one in the list
Does not affect any data itself, only the fetching and displaying of it (therefore, no [SR] is ever triggered by this method)
Аргументы
resolutionint The nth resolution of a second
// Have all time being reported in 1 second
// Have all time being reported in 1000th of a second (ms)
static proto void SetTimeResolution(int resolution)
Set the resolution of the fetched Time data.

Используется в EnProfilerTests::TestClassTimeData(), EnProfilerTests::TestFuncTimeData() и EnProfilerTests::TestModule().

◆ SortData()

static proto void SortData ( )
staticprivate

The internal sorting that happens at the end of the frame (so it is NOT necessary to call this manually) to supply Get...Per... functions.

Заметки
This will clear the previous [SD] and sort the [PD] currently available at this moment
Flags apply to this
Предупреждения
Keep in mind that EnProfilerFlags.RESET will clear all [PD] after this is called
// Sorting all the currently available [PD], populating [SD]
// If flag EnProfilerFlags.RESET is enabled, then this will return 0 now even if it has been called, as [PD] has been cleared
// This goes for any Get...Of... function (Except for [CI], the counter persists)
static proto void SortData()
The internal sorting that happens at the end of the frame (so it is NOT necessary to call this manual...

Используется в EnProfilerTests::TestModule().