ArmaScriptProfiler

From Bohemia Interactive Community
Jump to navigation Jump to search

General

Arma Script Profiler is a Mod that provides the ability to profile unscheduled SQF Scripts just like how Performance_Profiling does it for Engine internals.

Once you Capture a Frame the data is put into your Clipboard. To display it properly you need the Profiling build of Arma.
When one or multiple Frames were Captured it automatically opens the captureFrame UI and you have to click on "PASTE ALL" to paste your clipboard content and display the data.

Commands

createProfileScope

Description:
This creates a new scope. Store it in a a private local variable. Don't store it in a Global Variable!

Syntax

Syntax:
createProfileScope scopeName
Parameters:
scopeName : String - The name of your scope. This will be displayed in the output.
Return Value:
ProfileScope - a proprietary variable Type. This value going out of scope defines the end of the current Scope. So you have to store the result in a local variable.

Examples

Example 1:
private _scope = createProfileScope "testScope";



profilerBlockingSleep

Description:
This freezes the engine for 17ms. Used for testing.

Syntax

Syntax:
profilerBlockingSleep
Return Value:
Nothing



profilerCaptureFrame

Description:
Captures the next Frame.

Syntax

Syntax:
profilerCaptureFrame
Return Value:
Nothing

Examples

Example 1:
profilerCaptureFrame

Additional Information

See also:
diag_captureFrame



profilerCaptureFrames

Description:
Captures N Frames.

Syntax

Syntax:
profilerCaptureFrames NumberOfFrames
Parameters:
NumberOfFrames : Number - The Number of Frames to capture.
Return Value:
ProfileScope - a proprietary variable Type. This value going out of scope defines the end of the current Scope. So you have to store the result in a local variable.

Examples

Example 1:
profilerCaptureFrames 10;

Additional Information

See also:
diag_captureFrame



profilerCaptureSlowFrame

Description:
Captures the first frame that hits the threshold.
The runtime of all scripts in the current Frame are summed up. And if they hit the threshold it triggers a Capture.

Syntax

Syntax:
profilerCaptureSlowFrame threshold
Parameters:
threshold : Number - Threshold in milliseconds
Return Value:
Nothing

Examples

Example 1:
profilerCaptureSlowFrame 2;

Additional Information

See also:
diag_captureSlowFrame



profilerCaptureTrigger

Description:
Captures the first frame that contains a Trigger.

Syntax

Syntax:
profilerCaptureTrigger
Return Value:
Nothing



profilerTrigger

Description:
A Trigger for profilerCaptureTrigger.

Syntax

Syntax:
profilerTrigger
Return Value:
Nothing



profilerLog

Description:
Adds a log message to the current Scope.

Syntax

Syntax:
profilerLog message
Parameters:
message : String - The message to add.
Return Value:
Nothing

Examples

Example 1:
profilerLog "testLog";

profileScript

Description:
A more precise alternative to diag_codePerformance.
This outputs the results as double precision microseconds without any rounding. And it doesn't check for a timeout.
Meaning this WILL freeze your game if you go overboard with it. And it also works in MP.

Syntax

Syntax:
profileScript [code, arguments, runs]
Parameters:
code: Code - Your code to run
arguments: Anything - The arguments passed in _this (Warning: This overwrites your _this in your current scope
runs: Number - Number of runs to do (Default: 10000)
Return Value:
[Execution time per run in microseconds as Number, Execution time per run in microseconds as String, number of runs]

Examples

Example 1:
profileScript [{_a = 1 + 2 + 3}];