StartStackProfiling - Debug: Difference between revisions

From the CreationKit Wiki
Jump to navigation Jump to search
imported>JLundin
No edit summary
m (Convert source tags to syntaxhighlight)
 
(One intermediate revision by one other user not shown)
Line 7: Line 7:


== Syntax ==
== Syntax ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
Function StartStackProfiling() native global
Function StartStackProfiling() native global
</source>
</syntaxhighlight>


== Parameters ==
== Parameters ==
Line 18: Line 18:


== Examples ==
== Examples ==
<source lang="papyrus">
<syntaxhighlight lang="papyrus">
; Starts profiling this current stack
; Starts profiling this current stack
Debug.StartStackProfiling()
Debug.StartStackProfiling()
; Lots of slow script here
; Lots of slow script here
</source>
</syntaxhighlight>


== Notes ==
== Notes ==
Profiling requires the "bEnableProfiling" flag in the "[Papyrus]" section of the ini file to be set to 1. Consoles will never profile in release final builds. If you start profiling in a function that is called multiple times in the same stack and stop profiling at the end of the function, only the most recent calls are saved to disk as the logs will continue to cycle.
Profiling requires the "bEnableProfiling" flag in the "[Papyrus]" section of the ini file to be set to 1. Consoles will never profile in release final builds. If you start profiling in a function that is called multiple times in the same stack and stop profiling at the end of the function, only the most recent calls are saved to disk as the logs will continue to cycle.
The flamegraph visualizer [https://www.speedscope.app/ speedscope] supports all kinds of profiles that Skyrim produces, including those produced by this function.


== See Also ==
== See Also ==
*[[Debug Script]]
*[[Debug Script]]
*[[StopStackProfiling - Debug]]
*[[StopStackProfiling - Debug]]

Latest revision as of 20:22, 5 September 2026

Member of: Debug Script

Starts profiling a single Papyrus stack until stopped or until the last function exits. The profile files are stored in "<game folder>/Logs/Script/Profiling". This will also cycle the older profiling logs (so log 0 becomes 1, 1 becomes 2, etc). If the stack is already profiled nothing will change. Profiling requests are not saved and will be reset if you load a save game.

Syntax[edit | edit source]

Function StartStackProfiling() native global

Parameters[edit | edit source]

None.

Return Value[edit | edit source]

None.

Examples[edit | edit source]

; Starts profiling this current stack
Debug.StartStackProfiling()
; Lots of slow script here

Notes[edit | edit source]

Profiling requires the "bEnableProfiling" flag in the "[Papyrus]" section of the ini file to be set to 1. Consoles will never profile in release final builds. If you start profiling in a function that is called multiple times in the same stack and stop profiling at the end of the function, only the most recent calls are saved to disk as the logs will continue to cycle.

The flamegraph visualizer speedscope supports all kinds of profiles that Skyrim produces, including those produced by this function.

See Also[edit | edit source]