R3vo/Sandbox – User

From Bohemia Interactive Community
Jump to navigation Jump to search
mNo edit summary
 
(129 intermediate revisions by 2 users not shown)
Line 1: Line 1:
{{Navbox
{{TOC|side}}
|title= [[Real Virtuality]] Scripting Commands
If you have ever wondered why you scenario is running so badly, performance profiling is the way to find it out. It allows you to find bottlenecks and slow code by capturing a "slow" frame.
|color= #E0F0FF
The captured data can then be viewed and analysed.
|title1= By Game
|color1= #E0F0FF
|content1=
{{Navbox
|sub= y
|title1=[[:Category: {{tkoh}}: Scripting Commands|{{tkoh}}]]
|color1= #E0F0FF
|content1= {{GVI|tkoh|1.00}} {{GVI|tkoh|1.01}}
|title2= [[:Category: {{ofp}}: Scripting Commands|{{ofp}}]]
|color2= #E0F0FF
|content2= {{GVI|ofp|1.00}} {{GVI|ofp|1.04}} {{GVI|ofp|1.10}} {{GVI|ofp|1.20}} {{GVI|ofp|1.30}} {{GVI|ofp|1.46}} {{GVI|ofp|1.75}} {{GVI|ofp|1.78}} {{GVI|ofp|1.80}} {{GVI|ofp|1.85}} {{GVI|ofp|1.90}} {{GVI|ofp|1.99}}
|title3= [[:Category: {{ofpe}}: Scripting Commands|{{ofpe}}]]
|color3= #E0F0FF
|content3= {{GVI|ofpe|1.00}}
|title4= [[:Category: ArmA: Armed Assault: Scripting Commands|{{arma1}}]]
|color4= #E0F0FF
|content4= {{GVI|arma1|1.00}} {{GVI|arma1|1.04}} {{GVI|arma1|1.05}} {{GVI|arma1|1.06}} {{GVI|arma1|1.07}} {{GVI|arma1|1.08}} {{GVI|arma1|1.09}} {{GVI|arma1|1.11}}
|title5= [[:Category: {{arma2}}: Scripting Commands|{{arma2}}]]
|color5= #E0F0FF
|content5= {{GVI|arma2|1.00}} {{GVI|arma2|1.02}} {{GVI|arma2|1.03}} {{GVI|arma2|1.04}} {{GVI|arma2|1.05}} {{GVI|arma2|1.06}}
|title6= [[:Category: {{arma2oa}}: Scripting Commands|Arma&nbsp;2:&nbsp;Operation&nbsp;Arrowhead]] <!--- to force it into one line --->
|color6= #E0F0FF
|content6= {{GVI|arma2oa|1.51}} {{GVI|arma2oa|1.52}} {{GVI|arma2oa|1.54}} {{GVI|arma2oa|1.55}} {{GVI|arma2oa|1.57}} {{GVI|arma2oa|1.60}} {{GVI|arma2oa|1.62}} {{GVI|arma2oa|1.63}} {{GVI|arma2oa|1.64}}
|title7= [[:Category: {{arma3}}: Scripting Commands|{{arma3}}]]
|color7= #E0F0FF
|content7=
{{Navbox
|sub= y
|title1= Alpha
|color1= #ADBF83
|content1= {{GVI|arma3|0.50}} {{GVI|arma3|0.56}} {{GVI|arma3|0.58}}
|title2= Beta
|color2= #668C9B
|content2= {{GVI|arma3|0.70}} {{GVI|arma3|0.74}} {{GVI|arma3|0.76}}
|title3= Diag
|color3= #62A762
|content3= {{GVI|arma3|diag}}
|title4= Stable
|color4= #CCCCCC
|content4= {{GVI|arma3|1.00}} {{GVI|arma3|1.02}} {{GVI|arma3|1.04}} {{GVI|arma3|1.06}} {{GVI|arma3|1.08}} {{GVI|arma3|1.10}} {{GVI|arma3|1.12}} {{GVI|arma3|1.14}} {{GVI|arma3|1.16}} {{GVI|arma3|1.18}} {{GVI|arma3|1.20}} {{GVI|arma3|1.22}} {{GVI|arma3|1.24}} {{GVI|arma3|1.26}} {{GVI|arma3|1.32}} {{GVI|arma3|1.34}} {{GVI|arma3|1.36}} {{GVI|arma3|1.38}} {{GVI|arma3|1.40}} {{GVI|arma3|1.42}} {{GVI|arma3|1.44}} {{GVI|arma3|1.46}} {{GVI|arma3|1.48}} {{GVI|arma3|1.50}} {{GVI|arma3|1.52}} {{GVI|arma3|1.54}} {{GVI|arma3|1.56}} {{GVI|arma3|1.58}} {{GVI|arma3|1.60}} {{GVI|arma3|1.62}} {{GVI|arma3|1.64}} {{GVI|arma3|1.66}} {{GVI|arma3|1.68}} {{GVI|arma3|1.70}} {{GVI|arma3|1.72}} {{GVI|arma3|1.74}} {{GVI|arma3|1.76}} {{GVI|arma3|1.78}} {{GVI|arma3|1.80}} {{GVI|arma3|1.82}} {{GVI|arma3|1.84}} {{GVI|arma3|1.86}} {{GVI|arma3|1.90}} {{GVI|arma3|1.92}} {{GVI|arma3|1.94}} {{GVI|arma3|1.96}} {{GVI|arma3|1.98}} {{GVI|arma3|2.00}} {{GVI|arma3|2.02}} {{GVI|arma3|2.04}}
|title5= Dev
|color5= #E87600
|content5= {{GVI|arma3|Dev}}
}}
}}
|title2= [[:Category:Scripting Commands by Functionality|By Functionality]]
|color2= #E0F0FF
|content2= [[:Category:Command Group: Animations|Animations]] {{!}}
[[:Category:Command Group: Arrays|Arrays]] {{!}}
[[:Category:Command Group: Artillery|Artillery]] {{!}}
[[:Category:Command Group: Briefing|Briefing]] {{!}}
[[:Category:Command Group: Broken Commands|Broken Commands]] {{!}}
[[:Category:Command Group: Camera Control|Camera Control]] {{!}}
[[:Category:Command Group: Config|Config]] {{!}}
[[:Category:Command Group: Containers|Containers]] {{!}}
[[:Category:Command Group: Conversations|Conversations]] {{!}}
[[:Category:Command Group: Curator|Curator]] {{!}}
[[:Category:Command Group: Custom Panels|Custom Panels]] {{!}}
[[:Category:Command Group: Diagnostic|Diagnostic]] {{!}}
[[:Category:Command Group: Difficulty|Difficulty]] {{!}}
[[:Category:Command Group: Dynamic Simulation|Dynamic Simulation]] {{!}}
[[:Category:Command Group: Eden Editor|Eden Editor]] {{!}}
[[:Category:Command Group: Environment|Environment]] {{!}}
[[:Category:Command Group: Event Handlers|Event Handlers]] {{!}}
[[:Category:Command Group: Flags|Flags]] {{!}}
[[:Category:Command Group: Game 2 Editor|Game 2 Editor]] {{!}}
[[:Category:Command Group: Groups|Groups]] {{!}}
[[:Category:Command Group: GUI Control|GUI Control]] {{!}} ‎
[[:Category:Command Group: HashMap|HashMap]] {{!}}
[[:Category:Command Group: High Command|High Command]] {{!}}
[[:Category:Command Group: Interaction|Interaction]] {{!}}
[[:Category:Command Group: Leaderboards|Leaderboards]] {{!}}
[[:Category:Command Group: Lights|Lights]] {{!}}
[[:Category:Command Group: Localization|Localization]] {{!}}
[[:Category:Command Group: Locations|Locations]] {{!}}
[[:Category:Command Group: Map|Map]] {{!}}
[[:Category:Command Group: Markers|Markers]] {{!}}
[[:Category:Command Group: Math|Math]] {{!}} ‎
[[:Category:Command Group: Mines|Mines]] {{!}}
[[:Category:Command Group: Mission Information|Mission Information]] {{!}}
[[:Category:Command Group: Mods and Addons|Mods and Addons]] {{!}}
[[:Category:Command Group: Multiplayer|Multiplayer]] {{!}}
[[:Category:Command Group: Object Detection|Object Detection]] {{!}}
[[:Category:Command Group: Object Manipulation|Object Manipulation]] {{!}}
[[:Category:Command Group: Particles|Particles]] {{!}}
[[:Category:Command Group: Pilot Camera|Pilot Camera]] {{!}}
[[:Category:Command Group: Positions|Positions]] {{!}}
[[:Category:Command Group: Program Flow|Program Flow]] {{!}}
[[:Category:Command Group: Radio and Chat|Radio and Chat]] {{!}} ‎
[[:Category:Command Group: Remote Control|Remote Control]] {{!}}
[[:Category:Command Group: Render Time Scope|Render Time Scope]] {{!}}
[[:Category:Command Group: Roads and Airports|Roads and Airports]] {{!}}
[[:Category:Command Group: Ropes and Sling Loading|Ropes and Sling Loading]] {{!}}
[[:Category:Command Group: RTD|RTD]] {{!}}
[[:Category:Command Group: Sensors|Sensors]] {{!}}
[[:Category:Command Group: Sides|Sides]] {{!}}
[[:Category:Command Group: Sounds|Sounds]] {{!}}
[[:Category:Command Group: Stamina System|Stamina System]] {{!}}
[[:Category:Command Group: Strings|Strings]] {{!}}
[[:Category:Command Group: Structured Text|Structured Text]] {{!}}
[[:Category:Command Group: System|System]] {{!}}
[[:Category:Command Group: Team Switch|Team Switch]] {{!}}
[[:Category:Command Group: Teams|Teams]] {{!}}
[[:Category:Command Group: Time|Time]] {{!}}
[[:Category:Command Group: Triggers|Triggers]] {{!}}
[[:Category:Command Group: Turrets|Turrets]] {{!}}
[[:Category:Command Group: Uncategorised|Uncategorised]] {{!}} ‎
[[:Category:Command Group: Unit Control|Unit Control]] {{!}}
[[:Category:Command Group: Unit Identity|Unit Identity]] {{!}}
[[:Category:Command Group: Unit Inventory|Unit Inventory]] {{!}}
[[:Category:Command Group: Variables|Variables]] {{!}}
[[:Category:Command Group: Vehicle in Vehicle Transport|Vehicle in Vehicle Transport]] {{!}}
[[:Category:Command Group: Vehicle Inventory|Vehicle Inventory]] {{!}}
[[:Category:Command Group: Vehicle Loadouts|Vehicle Loadouts]] {{!}}
[[:Category:Command Group: Waypoints|Waypoints]] {{!}}
[[:Category:Command Group: Weapon Pool|Weapon Pool]] {{!}}
[[:Category:Command Group: Weapons|Weapons]]
|title3= See Also
|content3= [[:Category:Scripting Commands|All Scripting Commands]] {{!}} [[:Category:Functions|Functions]] {{!}} [[:Category:Functions by Functionality|Functions by Functionality]]
|color3= #E0F0FF
}}


== Getting the correct Version ==
Profiling is enabled in the following {{arma3}} versions
* arma3profiling_x64.exe - '''Part of the Performance Profiling Build'''
* arma3diag_x64.exe - '''Part of the Development Build'''


{{Navbox
Read [[Arma_3: Steam Branches]] for a guide on how to access these branches.
|title= [[Real Virtuality]] Scripting Functions
|color= #E0FFFF
|title1= By Game
|color1= #E0FFFF
|content1=
{{Navbox
|sub= y
|title1=[[:Category: {{tkoh}}: Functions|{{tkoh}}]]
|color1= #E0FFFF
|content1= {{GVI|tkoh|1.00}} {{GVI|tkoh|1.01}}
|title2= [[:Category: {{arma2}}: Functions|{{arma2}}]]
|color2= #E0FFFF
|content2= {{GVI|arma2|1.00}} {{GVI|arma2|1.02}} {{GVI|arma2|1.03}} {{GVI|arma2|1.04}} {{GVI|arma2|1.05}} {{GVI|arma2|1.06}}
|title3= [[:Category: {{arma2oa}}: Functions|Arma&nbsp;2:&nbsp;Operation&nbsp;Arrowhead]] <!--- to force it into one line --->
|color3= #E0FFFF
|content3= {{GVI|arma2oa|1.51}} {{GVI|arma2oa|1.52}} {{GVI|arma2oa|1.54}} {{GVI|arma2oa|1.55}} {{GVI|arma2oa|1.57}} {{GVI|arma2oa|1.60}} {{GVI|arma2oa|1.62}} {{GVI|arma2oa|1.63}} {{GVI|arma2oa|1.64}}
|title4= [[:Category: {{arma3}}: Functions|{{arma3}}]]
|color4= #E0FFFF
|content4=
{{Navbox
|sub= y
|title1= Alpha
|color1= #ADBF83
|content1= {{GVI|arma3|0.50}} {{GVI|arma3|0.56}} {{GVI|arma3|0.58}}
|title2= Beta
|color2= #668C9B
|content2= {{GVI|arma3|0.70}} {{GVI|arma3|0.74}} {{GVI|arma3|0.76}}
|title3= Diag
|color3= #62A762
|content3= {{GVI|arma3|diag}}
|title4= Stable
|color4= #CCCCCC
|content4= {{GVI|arma3|1.00}} {{GVI|arma3|1.02}} {{GVI|arma3|1.04}} {{GVI|arma3|1.06}} {{GVI|arma3|1.08}} {{GVI|arma3|1.10}} {{GVI|arma3|1.12}} {{GVI|arma3|1.14}} {{GVI|arma3|1.16}} {{GVI|arma3|1.18}} {{GVI|arma3|1.20}} {{GVI|arma3|1.22}} {{GVI|arma3|1.24}} {{GVI|arma3|1.26}} {{GVI|arma3|1.32}} {{GVI|arma3|1.34}} {{GVI|arma3|1.36}} {{GVI|arma3|1.38}} {{GVI|arma3|1.40}} {{GVI|arma3|1.42}} {{GVI|arma3|1.44}} {{GVI|arma3|1.46}} {{GVI|arma3|1.48}} {{GVI|arma3|1.50}} {{GVI|arma3|1.52}} {{GVI|arma3|1.54}} {{GVI|arma3|1.56}} {{GVI|arma3|1.58}} {{GVI|arma3|1.60}} {{GVI|arma3|1.62}} {{GVI|arma3|1.64}} {{GVI|arma3|1.66}} {{GVI|arma3|1.68}} {{GVI|arma3|1.70}} {{GVI|arma3|1.72}} {{GVI|arma3|1.74}} {{GVI|arma3|1.76}} {{GVI|arma3|1.78}} {{GVI|arma3|1.80}} {{GVI|arma3|1.82}} {{GVI|arma3|1.84}} {{GVI|arma3|1.86}} {{GVI|arma3|1.90}} {{GVI|arma3|1.92}} {{GVI|arma3|1.94}} {{GVI|arma3|1.96}} {{GVI|arma3|1.98}} {{GVI|arma3|2.00}} {{GVI|arma3|2.02}} {{GVI|arma3|2.04}}
|title5= Dev
|color5= #E87600
|content5= {{GVI|arma3|Dev}}
}}
}}
|title2= [[:Category:Functions by Functionality|By Functionality]]
|color2= #E0FFFF
|content2= [[:Category:Function Group: Ambient|Ambient]] {{!}}
[[:Category:Function Group: Arrays|Arrays]]
[[:Category:Function Group: Briefing|Briefing]] {{!}}
[[:Category:Function Group: Broken Functions|Broken Functions]] {{!}}
[[:Category:Function Group: Camera|Camera]] {{!}}
[[:Category:Function Group: Campaign|Campaign]]
[[:Category:Function Group: Combat|Combat]] {{!}}
[[:Category:Function Group: CombatPatrol|CombatPatrol]] {{!}}
[[:Category:Function Group: Communication Menu|Communication Menu]] {{!}}
[[:Category:Function Group: Configs|Configs]] {{!}}
[[:Category:Function Group: Contact|Contact]] {{!}}
[[:Category:Function Group: Conversations|Conversations]] {{!}}
[[:Category:Function Group: Curator|Curator]]
[[:Category:Function Group: Database|Database]] {{!}}
[[:Category:Function Group: Diagnostic|Diagnostic]] {{!}}
[[:Category:Function Group: Eden Editor|Eden Editor]] {{!}}
[[:Category:Function Group: Effects|Effects]] {{!}}
[[:Category:Function Group: Environment|Environment]] {{!}}
[[:Category:Function Group: Event Handlers|Event Handlers]] {{!}}
[[:Category:Function Group: Feedback|Feedback]] {{!}}
[[:Category:Function Group: GUI|GUI]] {{!}}
[[:Category:Function Group: Interaction|Interaction]] {{!}}
[[:Category:Function Group: Inventory|Inventory]] {{!}}
[[:Category:Function Group: KeyframeAnimation|KeyframeAnimation]]
[[:Category:Function Group: Live Feed|Live Feed]] {{!}}
[[:Category:Function Group: Map and Markers|Map and Markers]] {{!}}
[[:Category:Function Group: Math|Math]]
[[:Category:Function Group: Mission Parameters|Mission Parameters]] {{!}}
[[:Category:Function Group: Missions|Missions]] {{!}}
[[:Category:Function Group: Modules|Modules]]
[[:Category:Function Group: Multiplayer|Multiplayer]] {{!}}
[[:Category:Function Group: Object Manipulation|Object Manipulation]]
[[:Category:Function Group: Old Man|Old Man]]
[[:Category:Function Group: OO|OO]] {{!}}
[[:Category:Function Group: Positions|Positions]] {{!}}
[[:Category:Function Group: Priority Queue|Priority Queue]] {{!}}
[[:Category:Function Group: Program Flow|Program Flow]] {{!}}
[[:Category:Function Group: Radio|Radio]] {{!}}
[[:Category:Function Group: Respawn|Respawn]] {{!}}
[[:Category:Function Group: Revive|Revive]] {{!}}
[[:Category:Function Group: RichCurve|RichCurve]] {{!}}
[[:Category:Function Group: Scenes|Scenes]] {{!}}
[[:Category:Function Group: Scripts|Scripts]]
[[:Category:Function Group: Sides|Sides]] {{!}}
[[:Category:Function Group: Sound|Sound]] {{!}}
[[:Category:Function Group: Spectator|Spectator]] {{!}}
[[:Category:Function Group: Strategic|Strategic]] {{!}}
[[:Category:Function Group: Strings|Strings]] {{!}}
[[:Category:Function Group: Supports|Supports]] {{!}}
[[:Category:Function Group: Systems|Systems]] {{!}}
[[:Category:Function Group: Tasks|Tasks]] {{!}}
[[:Category:Function Group: Timeline|Timeline]] {{!}}
[[:Category:Function Group: Uncategorised|Uncategorised]] {{!}}
[[:Category:Function Group: Variables|Variables]] {{!}}
[[:Category:Function Group: Vehicles|Vehicles]] {{!}}
[[:Category:Function Group: VR|VR]] {{!}}
[[:Category:Function Group: Warlords|Warlords]] {{!}}
[[:Category:Function Group: Waypoints|Waypoints]] {{!}}
[[:Category:Function Group: Weapons|Weapons]]
|title3= See Also
|color3= #E0FFFF
|content3= [[Function|Functions explained]] {{!}} [[:Category:Functions|All Functions]] {{!}} [[Arma 2: Functions Library]] {{!}} [[Arma 3: Functions Library]] {{!}} [[Arma 3: CfgFunctions]]
}}


{{Feature|informative|It is recommended to use the '''Performance Profiling Build''' (arma3profiling_x64.exe) for performance profiling because:
* Has tools that might not make it into development build
* Has all the profiling related commands that ''arma3diag_x64.exe'' has
* Its performance is closer to the default ''arma3_x64.exe''}}


{| class="wikitable"
== Frame Capturing ==
There are several commands that allow you to capture a frame.
* [[diag_captureFrame]]
* [[diag_captureSlowFrame]]
* [[diag_logSlowFrame]] - not available in Arma 3 :(
* [[diag_captureFrameToFile]]
In most cases you do not want to capture any or all frames, you just want to capture "slow" frames. A slow frame is a frame that takes longer than the average frame and slows down the game.
 
== How to Use ==
# Run a mission
# Execute a scripted command <sqf inline>diag_captureSlowFrame ["total", 0.3];</sqf> using any means ([[Arma 3: Debug Console|Debug Console]], mission radio trigger...)
# Once a slow frame is detected, a window will open
# In the window you will be able to browse a lot of performance-related data, which can be interesting
# To export the gathered information for sharing with others:
## Select Main Thread (if not selected yet)
## Press the Copy button
## Open an external text editor
## Paste the text into a new file
## Save the file
 
== Capture Frame UI ==
[[File: arma3-capture frame ui overview.png]]
 
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
# {{Wiki|TODO}}
 
== External Viewer ==
* chrome://tracing
* https://ui.perfetto.dev/
 
[[File:Performance_Profiling_04.png|thumb|diag_captureFrame sample output with custom subtree]]
== Creating Your Own Subtree ==
 
When Profiling Per-Frame Eventhandlers (PFH), [[diag_captureFrame]] only shows one blob called siFEH that contains all PFH's so you can't see what part of that is caused by your PFH.<br>
You can create your own subtree inside siFEH by wrapping your function call inside a [[isNil]] CODE statement like this:<br>
Turn your old call which may look like this:
<sqf>
addMissionEventHandler ["EachFrame", {
call myPFHFunction
}];
</sqf>
 
Into something like this:
<sqf>
addMissionEventHandler ["EachFrame", {
isNil { call myPFHFunction } // isNil creates the subtree
}];
</sqf>
 
Now when you run [[diag_captureFrame]] inside of siPFH you will have a subtree called gsEva and behind that you can see the first line of code inside the isNil statement.<br>
It will only show a part of the first line of that code so you should put something descriptive into the [[isNil]] statement.<br>
You can use the same to create a subtree for any function you like. This will also work inside [[Scheduler#Scheduled_Environment|Scheduled]] ([[spawn]]ed) scripts. <br>
But using this method to "subtree" a function with return values requires a little bit of trickery to get the return value out.
 
 
== Notes ==
 
* 0.3 is a time in second used to determine what duration of a frame you consider abnormal, and first such frame will be captured.
* 0.3 is definitely something you should not see in a normal game.
* If you do not capture any frames with 0.3, try lowering it to 0.2 or 0.1.
* If it triggers too early, before the main slowdown happens, increase it to a higher value, e.g. 1.0.
 
== Scopes ==
{| class="wikitable sortable"
|-
! Technical Name !! Descriptive Name !! Description
|-
| Main
|
|
|-
| total
|
|
|-
| fsPHa
|
|
|-
| winMs
|
|
|-
| dlcSim
|
|
|-
| steamCbk
|
|
|-
| input
|
|
|-
| wSimu
|
|
|-
| docSim
|
|
|-
| wSimDisp
|
|
|-
| MFDManager
|
|
|-
| wDisp
|
|
|-
| EventPrcs
|
|
|-
| gsEva
|
|
|-
| gbFrm
|
|
|-
| memLo
|
|
|-
| siScr
|
|
|-
| scrVM
|
|
|-
| wsSet
|
|
|-
| sLand
|
|
|-
| simSW
|
|
|-
| cLWObj
|
|
|-
| oTemp
|
|
|-
| FPres
|
|
|-
| waitSnd
|
|
|-
| job
|
|
|-
| sound
|
|
|-
| ssAdv
|
|
|-
| snCmt
|
|
|-
| play
|
|
|-
| ARTCpl
|
|
|-
| rendr
|
|
|-
| drwVi
|
|
|-
| txHLi
|
|
|-
| txPMM
|
|
|-
| dsr2t
|
|
|-
| wPrep
|
|
|-
| dPr
|
|
|-
| fmiRun
|
|
|-
|-
! colspan="10" style="background-color:#E0F0FF;" | <big>[[Real Virtuality]] Scripting Commands</big>
| fmiWait
|
|
|-
|-
| '''By Game''' || [[:Category: {{tkoh}}: Scripting Commands|{{tkoh}}]] {{Icon|tkoh|24}} || [[:Category: {{ofp}}: Scripting Commands|{{ofp}}]] {{Icon|ofp|32}} || [[:Category: {{ofpe}}: Scripting Commands|{{ofpe}}]] {{Icon|ofpe|24}} || [[:Category: ArmA: Armed Assault: Scripting Commands|{{arma1}}]] {{Icon|arma1|32}} || [[:Category: {{arma2}}: Scripting Commands|{{arma2}}]] {{Icon|arma2|32}} || [[:Category: {{arma2oa}}: Scripting Commands|{{arma2oa}}]] {{Icon|arma2oa|32}} || [[:Category: {{arma3}}: Scripting Commands|{{arma3}}]] {{Icon|arma3|32}} || style="background-color:#62A762;" | [[:Category:Arma 3 Diagnostic Branch: New Scripting Commands| {{arma3}} Diagnostic Branch]] {{Icon|arma3diag|32}} || style="background-color:#E87600;" | [[:Category:Arma 3 Development Branch: New Scripting Commands|{{arma3}} Development Branch]]  {{Icon|arma3dev|32}}
| fmiMDrw
|  
|  
|-
|-
| '''By Functionality''' || colspan="9" | [[:Category:Command Group: Animations|'''A'''nimations]] ● [[:Category:Command Group: Arrays|'''A'''rrays]] ● [[:Category:Command Group: Artillery|'''A'''rtillery]] ● [[:Category:Command Group: Briefing|'''B'''riefing]] ● [[:Category:Command Group: Broken Commands|'''B'''roken Commands]] ● [[:Category:Command Group: Camera Control|'''C'''amera Control]] ● [[:Category:Command Group: Config|'''C'''onfig]] ● [[:Category:Command Group: Containers|'''C'''ontainers]] ● [[:Category:Command Group: Conversations|'''C'''onversations]] ● [[:Category:Command Group: Curator|'''C'''urator]] ● [[:Category:Command Group: Custom Panels|'''C'''ustom Panels]] ● [[:Category:Command Group: Diagnostic|'''D'''iagnostic]] ● [[:Category:Command Group: Difficulty|'''D'''ifficulty]] ● [[:Category:Command Group: Dynamic Simulation|'''D'''ynamic Simulation]] ● [[:Category:Command Group: Eden Editor|'''E'''den Editor]] ● [[:Category:Command Group: Environment|'''E'''nvironment]] ● [[:Category:Command Group: Event Handlers|'''E'''vent Handlers]] ● [[:Category:Command Group: Flags|'''F'''lags]] ● [[:Category:Command Group: Game 2 Editor|'''G'''ame 2 Editor]] ● [[:Category:Command Group: Groups|'''G'''roups]] ● [[:Category:Command Group: GUI Control|'''G'''UI Control]] ● [[:Category:Command Group: HashMap|'''H'''ashMap]] ● [[:Category:Command Group: High Command|'''H'''igh Command]] ● [[:Category:Command Group: Interaction|'''I'''nteraction]] ● [[:Category:Command Group: Leaderboards|'''L'''eaderboards]] ● [[:Category:Command Group: Lights|'''L'''ights]] ● [[:Category:Command Group: Localization|'''L'''ocalization]] ● [[:Category:Command Group: Locations|'''L'''ocations]] ● [[:Category:Command Group: Map|'''M'''ap]] ● [[:Category:Command Group: Markers|'''M'''arkers]] ● [[:Category:Command Group: Math|'''M'''ath]] ● ‎[[:Category:Command Group: Mines|'''M'''ines]] ● [[:Category:Command Group: Mission Information|'''M'''ission Information]] ● [[:Category:Command Group: Mods and Addons|'''M'''ods and Addons]] ● [[:Category:Command Group: Multiplayer|'''M'''ultiplayer]] ● [[:Category:Command Group: Object Detection|'''O'''bject Detection]] ● [[:Category:Command Group: Object Manipulation|'''O'''bject Manipulation]] ● [[:Category:Command Group: Particles|'''P'''articles]] ● [[:Category:Command Group: Pilot Camera|'''P'''ilot Camera]] ● [[:Category:Command Group: Positions|'''P'''ositions]] ● [[:Category:Command Group: Program Flow|'''P'''rogram Flow]] ● [[:Category:Command Group: Radio and Chat|'''R'''adio and Chat]] ● [[:Category:Command Group: Regular Expression (Regex)|'''R'''egular Expression (Regex)]] ● ‎[[:Category:Command Group: Remote Control|'''R'''emote Control]] ● [[:Category:Command Group: Render Time Scope|'''R'''ender Time Scope]] ● [[:Category:Command Group: Roads and Airports|'''R'''oads and Airports]] ● [[:Category:Command Group: Ropes and Sling Loading|'''R'''opes and Sling Loading]] ● [[:Category:Command Group: RTD|'''R'''TD]] ● [[:Category:Command Group: Sensors|'''S'''ensors]] ● [[:Category:Command Group: Sides|'''S'''ides]] ● [[:Category:Command Group: Sounds|'''S'''ounds]] ● [[:Category:Command Group: Stamina System|'''S'''tamina System]] ● [[:Category:Command Group: Strings|'''S'''trings]] ● [[:Category:Command Group: Structured Text|'''S'''tructured Text]] ● [[:Category:Command Group: System|'''S'''ystem]] ● [[:Category:Command Group: Team Switch|'''T'''eam Switch]] ● [[:Category:Command Group: Teams|'''T'''eams]] ● [[:Category:Command Group: Time|'''T'''ime]] ● [[:Category:Command Group: Triggers|'''T'''riggers]] ● [[:Category:Command Group: Turrets|'''T'''urrets]] ● [[:Category:Command Group: Uncategorised|'''U'''ncategorised]] ● ‎[[:Category:Command Group: Unit Control|'''U'''nit Control]] ● [[:Category:Command Group: Unit Identity|'''U'''nit Identity]] ● [[:Category:Command Group: Unit Inventory|'''U'''nit Inventory]] ● [[:Category:Command Group: Variables|'''V'''ariables]] ● [[:Category:Command Group: Vehicle in Vehicle Transport|'''V'''ehicle in Vehicle Transport]] ● [[:Category:Command Group: Vehicle Inventory|'''V'''ehicle Inventory]] ● [[:Category:Command Group: Vehicle Loadouts|'''V'''ehicle Loadouts]] ● [[:Category:Command Group: Waypoints|'''W'''aypoints]] ● [[:Category:Command Group: Weapon Pool|'''W'''eapon Pool]] ● [[:Category:Command Group: Weapons|'''W'''eapons]]
| fmiSIns
|  
|  
|-
|-
| '''See Also''' || colspan="9" | [[:Category:Scripting Commands|All Scripting Commands]] {{!}} [[:Category:Functions|Functions]] {{!}} [[:Category:Functions by Functionality|Functions by Functionality]]
| wPrepFtr
|  
|  
|-
| clPrp
|  
|
|-
| oPrep
|
|
|-
| sceAC
|
|
|-
| oSplt
|
|
|-
| sceACTA
|
|
|-
| sceACPrx
|
|
|-
| lodUL
|
|
|-
| PrxObj
|
|
|-
| manAn
|
|
|-
| ppdOT
|
|
|-
| flProx
|
|
|-
| PrxObjTransport
|
|
|-
| oSoSL
|
|
|-
| oSoJE
|
|
|-
| oSoJE1
|
|
|-
| oSoJE2
|
|
|-
| oSo1OFOv
|
|
|-
| oSo1ON
|
|
|-
| sceCLsHSH
|
|
|-
| prpAMCt
|
|
|-
| oSoJEw
|
|
|-
| pDrwFNP
|
|
|-
| oSoSLu
|
|
|-
| lPGCl
|
|
|-
| pdDrw
|
|
|-
| lDGnd
|
|
|-
| lGSMM
|
|
|-
| recCB
|
|
|-
| mtPmj
|
|
|-
| cuDrw
|
|
|-
| prepT
|
|
|-
| drwCB
|
|
|-
| oPasD
|
|
|-
| o1Drw
|
|
|-
| lckDnBf
|
|
|-
| prpTx
|
|
|-
| inst
|
|
|-
| stpSctnTL
|
|
|-
| o1ShV
|
|
|-
| scSVI
|
|
|-
| oPas3
|
|
|-
| sssmC
|
|
|-
| sbDrw
|
|
|-
| aniMt
|
|
|-
| ppSSSM
|
|
|-
| drwROM
|
|
|-
| drwIn
|
|
|-
| wDraw
|
|
|-
| lDPGT
|
|
|-
| oSDrw
|
|
|-
| oPasO
|
|
|-
| lDSky
|
|
|-
| swRdr
|
|
|-
| ppSWDD
|
|
|-
| swRdGeom
|
|
|-
| swRdGeomVB
|
|
|-
| swFillV
|
|
|-
| oPasA
|
|
|-
| ppShrpn
|
|
|-
| lDWat
|
|
|-
| oPas2
|
|
|-
| o2Drw
|
|
|-
| oPas5
|
|
|-
| o5Drw
|
|
|-
| EDraw3D
|
|
|-
| MEventPrcs
|
|
|-
| cLGSY
|
|
|-
| stpAll
|
|
|-
| stpCB
|
|
|-
| stpTxtCS
|
|
|-
| stpUAVsCS
|
|
|-
| ppHDRCL
|
|
|-
| ppGSB
|
|
|-
| ppDOF
|
|
|-
| ppGlwNw
|
|
|-
| ppGLu
|
|
|-
| stpCBUpd
|
|
|-
| ppQWt
|
|
|-
| ppCMAA
|
|
|-
| hudDr
|
|
|-
| 3DEN_UI_OnDraw
|
|
|-
| 3DEN_PrepareDraw
|
|
|-
| clObL
|
|
|-
| 3DEN_Drawing
|
|
|-
| stpTxtGS
|
|
|-
| txt2D
|
|
|-
| mapDr
|
|
|-
| mapSeaAndNormal
|
|
|-
| mapPM
|
|
|-
| lndPM
|
|
|-
| MapObjectsPrepTask
|
|
|-
| mapSeaAndNormalDraw
|
|
|-
| mapCntDraw
|
|
|-
| mapObjectsDraw
|
|
|-
| mapForestShape
|
|
|-
| mapGrid
|
|
|-
| drwFn
|
|
|-
| dtTot
|
|
|-
| wFram
|
|
|-
| 3dSwp
|
|
|-
| preLd
|
|
|-
| preLV
|
|
|-
| actObjPrld
|
|
|-
| hashChk
|
|
|-
| sSim
|
|
|-
| enfWorkShort
|
|
|-
| updAttPos
|
|
|-
| oSo1AN
|
|
|-
| prpAMCf
|
|
|-
| prpAMCSlt
|
|
|-
| prpSDM
|
|
|-
| locL
|
|
|-
| mapSeaAndNormalWork
|
|
|-
| mapObjectsPrepWork
|
|
|-
| drwIdxPrm
|
|
|-
| oSo3
|
|
|-
| lsCVB
|
|
|-
| oSo5
|
|
|-
| oSo2CL
|
|
|-
| oSo1AF
|
|
|-
| Visualize
|
|
|-
| visul
|
|
|-
| txMLo
|
|
|-
| oSo2Srt
|
|
|-
| oSoSdw
|
|
|-
| prpAMCbsi
|
|
|-
| prpAMCp
|
|
|-
| Render
|
|
|-
| bgD3D
|
|
|-
| stpTxtVS
|
|
|-
| ppHBAOPlus
|
|  
|}
|}
<sqf>
private _ctrlTV = ctrlparent (_this select 0) displayCtrl 101;
private _export = "{| class=""wikitable sortable"""  + endl + "|-" + endl;
_export = _export + "! Technical Name !! Descriptive Name !! Description";
private _fnc_logChilden =
{
    params ["_path"];
    for "_i" from 0 to ((_ctrlTV tvCount _path) - 1) do
    {
        private _text = _ctrlTV tvText (_path + [_i]);
        _text = _text splitString " " select 0;
        if !(_text in _export) then
        {
            _export = _export + endl + "|-" + endl + "| " + _text + endl + "| " + endl + "| ";
        };
        if (_ctrlTV tvCount (_path + [_i]) > 0 ) then
        {
            [_path + [_i]] call _fnc_logChilden;
        };
    };
};
[[]] call _fnc_logChilden;
copyToClipboard (_export + endl + "|}" + endl);
</sqf>
== See Also ==
* [[Code Optimisation]]
* [[Mission Optimisation]]
[[Category:Arma Scripting Tutorials]]

Latest revision as of 18:23, 4 November 2024

If you have ever wondered why you scenario is running so badly, performance profiling is the way to find it out. It allows you to find bottlenecks and slow code by capturing a "slow" frame. The captured data can then be viewed and analysed.

Getting the correct Version

Profiling is enabled in the following Arma 3 versions

  • arma3profiling_x64.exe - Part of the Performance Profiling Build
  • arma3diag_x64.exe - Part of the Development Build

Read Arma_3: Steam Branches for a guide on how to access these branches.

It is recommended to use the Performance Profiling Build (arma3profiling_x64.exe) for performance profiling because:
  • Has tools that might not make it into development build
  • Has all the profiling related commands that arma3diag_x64.exe has
  • Its performance is closer to the default arma3_x64.exe

Frame Capturing

There are several commands that allow you to capture a frame.

In most cases you do not want to capture any or all frames, you just want to capture "slow" frames. A slow frame is a frame that takes longer than the average frame and slows down the game.

How to Use

  1. Run a mission
  2. Execute a scripted command diag_captureSlowFrame ["total", 0.3]; using any means (Debug Console, mission radio trigger...)
  3. Once a slow frame is detected, a window will open
  4. In the window you will be able to browse a lot of performance-related data, which can be interesting
  5. To export the gathered information for sharing with others:
    1. Select Main Thread (if not selected yet)
    2. Press the Copy button
    3. Open an external text editor
    4. Paste the text into a new file
    5. Save the file

Capture Frame UI

arma3-capture frame ui overview.png

  1. 🚧
    TODO: this must be updated.
  2. 🚧
    TODO: this must be updated.
  3. 🚧
    TODO: this must be updated.
  4. 🚧
    TODO: this must be updated.
  5. 🚧
    TODO: this must be updated.
  6. 🚧
    TODO: this must be updated.
  7. 🚧
    TODO: this must be updated.
  8. 🚧
    TODO: this must be updated.
  9. 🚧
    TODO: this must be updated.

External Viewer

diag_captureFrame sample output with custom subtree

Creating Your Own Subtree

When Profiling Per-Frame Eventhandlers (PFH), diag_captureFrame only shows one blob called siFEH that contains all PFH's so you can't see what part of that is caused by your PFH.
You can create your own subtree inside siFEH by wrapping your function call inside a isNil CODE statement like this:
Turn your old call which may look like this:

addMissionEventHandler ["EachFrame", { call myPFHFunction }];

Into something like this:

addMissionEventHandler ["EachFrame", { isNil { call myPFHFunction } // isNil creates the subtree }];

Now when you run diag_captureFrame inside of siPFH you will have a subtree called gsEva and behind that you can see the first line of code inside the isNil statement.
It will only show a part of the first line of that code so you should put something descriptive into the isNil statement.
You can use the same to create a subtree for any function you like. This will also work inside Scheduled (spawned) scripts.
But using this method to "subtree" a function with return values requires a little bit of trickery to get the return value out.


Notes

  • 0.3 is a time in second used to determine what duration of a frame you consider abnormal, and first such frame will be captured.
  • 0.3 is definitely something you should not see in a normal game.
  • If you do not capture any frames with 0.3, try lowering it to 0.2 or 0.1.
  • If it triggers too early, before the main slowdown happens, increase it to a higher value, e.g. 1.0.

Scopes

Technical Name Descriptive Name Description
Main
total
fsPHa
winMs
dlcSim
steamCbk
input
wSimu
docSim
wSimDisp
MFDManager
wDisp
EventPrcs
gsEva
gbFrm
memLo
siScr
scrVM
wsSet
sLand
simSW
cLWObj
oTemp
FPres
waitSnd
job
sound
ssAdv
snCmt
play
ARTCpl
rendr
drwVi
txHLi
txPMM
dsr2t
wPrep
dPr
fmiRun
fmiWait
fmiMDrw
fmiSIns
wPrepFtr
clPrp
oPrep
sceAC
oSplt
sceACTA
sceACPrx
lodUL
PrxObj
manAn
ppdOT
flProx
PrxObjTransport
oSoSL
oSoJE
oSoJE1
oSoJE2
oSo1OFOv
oSo1ON
sceCLsHSH
prpAMCt
oSoJEw
pDrwFNP
oSoSLu
lPGCl
pdDrw
lDGnd
lGSMM
recCB
mtPmj
cuDrw
prepT
drwCB
oPasD
o1Drw
lckDnBf
prpTx
inst
stpSctnTL
o1ShV
scSVI
oPas3
sssmC
sbDrw
aniMt
ppSSSM
drwROM
drwIn
wDraw
lDPGT
oSDrw
oPasO
lDSky
swRdr
ppSWDD
swRdGeom
swRdGeomVB
swFillV
oPasA
ppShrpn
lDWat
oPas2
o2Drw
oPas5
o5Drw
EDraw3D
MEventPrcs
cLGSY
stpAll
stpCB
stpTxtCS
stpUAVsCS
ppHDRCL
ppGSB
ppDOF
ppGlwNw
ppGLu
stpCBUpd
ppQWt
ppCMAA
hudDr
3DEN_UI_OnDraw
3DEN_PrepareDraw
clObL
3DEN_Drawing
stpTxtGS
txt2D
mapDr
mapSeaAndNormal
mapPM
lndPM
MapObjectsPrepTask
mapSeaAndNormalDraw
mapCntDraw
mapObjectsDraw
mapForestShape
mapGrid
drwFn
dtTot
wFram
3dSwp
preLd
preLV
actObjPrld
hashChk
sSim
enfWorkShort
updAttPos
oSo1AN
prpAMCf
prpAMCSlt
prpSDM
locL
mapSeaAndNormalWork
mapObjectsPrepWork
drwIdxPrm
oSo3
lsCVB
oSo5
oSo2CL
oSo1AF
Visualize
visul
txMLo
oSo2Srt
oSoSdw
prpAMCbsi
prpAMCp
Render
bgD3D
stpTxtVS
ppHBAOPlus

private _ctrlTV = ctrlparent (_this select 0) displayCtrl 101; private _export = "{| class=""wikitable sortable""" + endl + "|-" + endl; _export = _export + "! Technical Name !! Descriptive Name !! Description"; private _fnc_logChilden = { params ["_path"]; for "_i" from 0 to ((_ctrlTV tvCount _path) - 1) do { private _text = _ctrlTV tvText (_path + [_i]); _text = _text splitString " " select 0; if !(_text in _export) then { _export = _export + endl + "|-" + endl + "| " + _text + endl + "| " + endl + "| "; }; if (_ctrlTV tvCount (_path + [_i]) > 0 ) then { [_path + [_i]] call _fnc_logChilden; }; }; }; [[]] call _fnc_logChilden; copyToClipboard (_export + endl + "|}" + endl);

See Also