ArmaScriptProfiler: Difference between revisions
Jump to navigation
Jump to search
Lou Montana (talk | contribs) m (Comment out missing pictures) |
Lou Montana (talk | contribs) m (Text replacement - "<code>" to "<code style="display: block">") |
||
(4 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
{{ | {{TOC|side||3}} | ||
==General== | == General == | ||
Arma Script Profiler is a Mod that provides the ability to profile [[Scheduler|unscheduled]] SQF Scripts just like how [[Performance_Profiling]] does it for Engine internals.<br> | Arma Script Profiler is a Mod that provides the ability to profile [[Scheduler|unscheduled]] SQF Scripts just like how [[Performance_Profiling]] does it for Engine internals.<br> | ||
Once you Capture a Frame the data is put into your Clipboard. To display it properly you need the [[Performance_Profiling# | Once you Capture a Frame the data is put into your Clipboard. To display it properly you need the [[Performance_Profiling#Versions with performance profiling|Profiling build]] of Arma.<br> | ||
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. | 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. | ||
{{Clear}} | |||
== Commands == | |||
<div class="_description cmd"> | <div class="_description cmd"> | ||
Line 32: | Line 31: | ||
<h4>Examples</h4> | <h4>Examples</h4> | ||
<dl><dt>Example 1:</dt><dd class="example"><code>private _scope = createProfileScope "testScope";</code><!--[[File:ArmaScriptProfiler_profilerLogExample.png|thumb|example output]]--></dd> | <dl><dt>Example 1:</dt><dd class="example"><code style="display: block">private _scope = createProfileScope "testScope";</code><!--[[File:ArmaScriptProfiler_profilerLogExample.png|thumb|example output]]--></dd> | ||
</dl> | </dl> | ||
Line 74: | Line 73: | ||
<h4>Examples</h4> | <h4>Examples</h4> | ||
<dl><dt>Example 1:</dt><dd class="example"><code>profilerCaptureFrame</code></dd> | <dl><dt>Example 1:</dt><dd class="example"><code style="display: block">profilerCaptureFrame</code></dd> | ||
</dl> | </dl> | ||
<h4>Additional Information</h4> | <h4>Additional Information</h4> | ||
Line 104: | Line 103: | ||
<h4>Examples</h4> | <h4>Examples</h4> | ||
<dl><dt>Example 1:</dt><dd class="example"><code>profilerCaptureFrames 10;</code></dd> | <dl><dt>Example 1:</dt><dd class="example"><code style="display: block">profilerCaptureFrames 10;</code></dd> | ||
</dl> | </dl> | ||
<h4>Additional Information</h4> | <h4>Additional Information</h4> | ||
Line 135: | Line 134: | ||
<h4>Examples</h4> | <h4>Examples</h4> | ||
<dl><dt>Example 1:</dt><dd class="example"><code>profilerCaptureSlowFrame 2;</code></dd> | <dl><dt>Example 1:</dt><dd class="example"><code style="display: block">profilerCaptureSlowFrame 2;</code></dd> | ||
</dl> | </dl> | ||
<h4>Additional Information</h4> | <h4>Additional Information</h4> | ||
Line 203: | Line 202: | ||
</dl> | </dl> | ||
<h4>Examples</h4> | <h4>Examples</h4> | ||
<dl><dt>Example 1:</dt><dd class="example"><code>profilerLog "testLog";</code></dd> | <dl><dt>Example 1:</dt><dd class="example"><code style="display: block">profilerLog "testLog";</code></dd> | ||
</dl> | </dl> | ||
Line 222: | Line 221: | ||
<dt>Parameters:</dt> | <dt>Parameters:</dt> | ||
<dd class="param">code: [[Code]] - Your code to run</dd> | <dd class="param">code: [[Code]] - Your code to run</dd> | ||
<dd class="param">arguments: [[ | <dd class="param">arguments: [[Anything]] - The arguments passed in _this (Warning: This overwrites your _this in your current scope</dd> | ||
<dd class="param">runs: [[Number]] - Number of runs to do (Default: 10000)</dd> | <dd class="param">runs: [[Number]] - Number of runs to do (Default: 10000)</dd> | ||
<dt>Return Value:</dt> | <dt>Return Value:</dt> | ||
Line 228: | Line 227: | ||
</dl> | </dl> | ||
<h4>Examples</h4> | <h4>Examples</h4> | ||
<dl><dt>Example 1:</dt><dd class="example"><code>profileScript [{_a = 1 + 2 + 3}];</code></dd> | <dl><dt>Example 1:</dt><dd class="example"><code style="display: block">profileScript [{_a = 1 + 2 + 3}];</code></dd> | ||
</dl> | </dl> | ||
</div> | |||
[[Category:Community Tools]] | |||
Latest revision as of 11:52, 11 January 2023
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}];