Performance
Overview
PopcornFX performance can be inspected in various ways

Some performance helpers can be accessed via the PopcornFX menu in UE4 toolbar.

It is also possible to invoke specific commands from the console
Stats

There are several ways to display general stats for the plugin:
-
Type
stat popcornfxin the console -
Select
Cmd stat PopcornFXin thePopcornFXMenu of UE4 toolbar -
Select the `Stats > Advanced > PopcornFX`menu from any UE4 viewport
Cycle counters provide general timings for parts of the CPU frame:
-
Update: PopcornFX update time: Total update thread time on the main thread (various task run asynchronously in worker threads) -
Render: GDME: Total render thread time for emitting PopcornFX draw calls for regular render passes (Transparency, Opaque, ..) -
Render: GDRTI: Total render thread time for emitting PopcornFX draw calls for raytracing passes
Counters provide a general view of the total number of particles, draw calls, mediums in all loaded levels at any given time.
Top offenders view

There are several ways to display the top offenders view (also named HUD profiler):
-
Type
PopcornFX.ToggleProfilerHUDin the console -
Select
Cmd ToggleProfilerHUDin thePopcornFXMenu of UE4 toolbar
This view provides high level information of what effects are currently loaded in all loaded levels. Effects can be filtered out by tweaking the plugin’s runtime settings.
Threading
PopcornFX simulation and rendering is multithreaded, using a "worker thread" pool. By default, the plugin uses PopcornFX C++ SDK default thread pool, which will use all available logical cores, minus 2 (leaving the main thread & rendering thread). This works fine by default, but for game productions it is recommended to directly schedule PopcornFX tasks in UE4’s task graph, which allows better scheduling with other UE4 tasks (& less worker threads)
To enable this code path, simply add the following 2 lines to your project’s Config/DefaultEngine.ini file:
[PopcornFX]
bUseUETaskGraph=True
At startup, the plugin will fetch this variable to determine whether or not to use UE4’s task graph. Enabling this effectively lets UE4 schedule PopcornFX tasks in its task graph. Knowing that UE4’s task graph will be tweaked by Epic per platforms, based on UE4’s workload and frame layout, ultimately it’s best to use this option for PopcornFX particles.
Note: In future PopcornFX UE4 plugin versions, this might become the default.
Unreal Insights

All "scope cycle" markers the plugin registers (viewed when using the stat popcornfx command) are visible by default in UE4 Insights.
To view PopcornFX C++ SDK tasks content, add this to your project’s Config/DefaultEngine.ini file:
bRecordProfileMarkers=True
Note: It is mandatory to enable bUseUETaskGraph, like so:
[PopcornFX]
bUseUETaskGraph=True
bRecordProfileMarkers=True
For the capture above, UE4 Editor was launched with the following additional options: -tracehost=127.0.0.1 -trace=cpu -statnamedevents
Legacy profiler

PopcornFX C++ SDK embeds a CPU profiler and allows viewing captured frames in a standalone .exe file.
To capture CPU frames, type in the console PopcornFX.RecordProfilerReport.
By default, the command will capture 10 frames, and prompt you to enter a dst file name for the report. The saved file can then be drag & dropped onto ProfilerReplay executable.
This executable can be downloaded here.
Note: It not possible to record .pkpr files if bRecordProfileMarkers is enabled.

