profiling-and-optimization

Diagnose Unreal Engine CPU, GPU, and memory bottlenecks using Unreal Insights, stat commands, and C++ instrumentation.

1|Updated Sep 6, 2026
One-click install
npx skills add https://github.com/ziyarduc/Baran-bk-game --skill profiling-and-optimization-ziyarduc
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: profiling-and-optimization
Source: https://github.com/ziyarduc/Baran-bk-game/tree/main/.agents/skills/profiling-and-optimization
Command: npx skills add https://github.com/ziyarduc/Baran-bk-game --skill profiling-and-optimization-ziyarduc

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve? Unreal Engine projects suffer from frame-rate drops, hitches, and memory growth that are hard to fix without knowing which thread or subsystem owns the frame budget. This Skill provides a measurement-first workflow that pinpoints the actual hotspot before any optimization work begins. ## Core Features & Use Cases - Triage with stat commands: Read stat unit, stat gpu, stat scenerendering, and stat memory to determine whether the game thread, render thread, GPU, or RHI thread is the bottleneck. - Deep profiling with Unreal Insights: Capture .utrace sessions with cpu, gpu, memalloc, and memtag channels, then analyze Timing Insights and Memory Insights to find the heaviest scopes and leaking allocations. - C++ instrumentation: Add named timing scopes with TRACE_CPUPROFILER_EVENT_SCOPE, SCOPE_CYCLE_COUNTER, QUICK_SCOPE_CYCLE_COUNTER, and CSV_SCOPED_TIMING_STAT so your own systems appear in profiles. - Use Case: Your packaged build hitches every few seconds. Run stat unit to confirm the game thread dominates, capture an Insights trace, sort the Timers tab by inclusive time, and discover an unthrottled actor tick as the culprit. ## Quick Start Ask the assistant to profile your Unreal Engine project and identify whether the frame-time bottleneck is on the CPU, GPU, or memory side.

Frequently Asked Questions about profiling-and-optimization

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I find CPU or GPU bottlenecks in Unreal Engine?▼

Run `stat unit` first to see the Frame, Game, Draw, GPU, and RHIT thread times. Whichever thread matches the total frame time owns the bottleneck; then use `stat game`, `stat gpu`, or an Unreal Insights trace to drill into specific scopes.

How do I use Unreal Insights to profile my game?▼

Launch your game with `-trace=cpu,gpu,frame,bookmark,log -tracehost=127.0.0.1` or start a trace from the Editor toolbar. Open the resulting .utrace file in UnrealInsights.exe and use the Timing Insights Timers tab sorted by inclusive time to find hotspots.

What is the difference between SCOPE_CYCLE_COUNTER and TRACE_CPUPROFILER_EVENT_SCOPE?▼

SCOPE_CYCLE_COUNTER feeds the stat system so the scope appears in `stat <group>` HUD overlays, while TRACE_CPUPROFILER_EVENT_SCOPE writes directly to the trace cpu channel with lower overhead. Prefer the trace macro for high-frequency code paths.

Can I profile performance in a Shipping build?▼

Stat macros compile to nothing in Shipping because STATS is 0, and CPUPROFILERTRACE_ENABLED is also 0. Use CSV_SCOPED_TIMING_STAT, which works in Test and Shipping builds, for production-visible timing metrics.

How do I find memory leaks in Unreal Engine?▼

Run a Development build with `-trace=memalloc,memtag,callstack,module -llm` and open Memory Insights. Use the Memory Leaks query with markers around a level transition to find allocations that survived when they should have been freed.

Why does DECLARE_CYCLE_STAT cause linker errors in a header?▼

DECLARE_CYCLE_STAT emits a static DEFINE_STAT, so including the header in multiple translation units creates duplicate symbols. Use DECLARE_CYCLE_STAT_EXTERN in the header and DEFINE_STAT in exactly one .cpp file instead.