Logo vun Ue Profiling And Optimization

Ue Profiling And Optimization

Communautéit
kevinpbuckley
ue-profiling-and-optimization

Profile and optimize Unreal Engine performance — Unreal Insights (trace-based CPU/GPU/memory profiling, .utrace sessions, Timing Insights, Memory Insights), stat commands (stat unit/fps/game/gpu/scenerendering/memory and the full stat command table), stat groups, C++ instrumentation (DECLARE_STATS_GROUP, DECLARE_CYCLE_STAT, SCOPE_CYCLE_COUNTER, QUICK_SCOPE_CYCLE_COUNTER, TRACE_CPUPROFILER_EVENT_SCOPE, CSV_SCOPED_TIMING_STAT), memory profiling (LLM, MemReport, memreport -full), and the measurement-first optimization workflow. Use when diagnosing frame-rate drops, hitches, CPU/GPU bottlenecks, or memory growth, when adding timing instrumentation to find a hotspot, or when deciding on CPU vs GPU vs memory optimization levers.

Iwwersiicht

Editeurkevinpbuckley
Repositoryunreal-engine-skills
Skill-Nummue-profiling-and-optimization
Stären
89
Forks
9
Matgeliwwert Fichieren
4
Linken
  • Instruktiounen am Markdown-Format

    Eng SKILL.md-Datei, déi de Modell bei Bedarf luet, soudatt nëmmen Token ufalen, wann eng Ufro tatsächlech dozou passt.

  • Funktionéiert mat all LLM

    KI-Skills si reng Markdown, keen ubidderspezifesche Code. Dofir funktionéiert dëse Skill mat GPT, Claude, Gemini, Grok oder engem lokale Modell.

  • 4 matgeliwwert Dateien

    Skripten, Virlagen a Referenzen, déi de Modell beim Schaffe liese kann. D'Dateie kënnen nëmme gelies ginn a ginn ni ausgeféiert.

  • Open Source

    Vum kevinpbuckley op GitHub verëffentlecht. Liest de Quelltext, ier Dir de Skill installéiert.

Installatioun

Installéiert de KI-Skill Ue Profiling And Optimization an TypingMind, fir e mat all LLM ze benotzen, oder füügt en an en anere KI-Agent an, deen SKILL.md liest.

1

An TypingMind installéieren

TypingMind installéiert e Skill direkt aus sengem GitHub-Dossier — dobäi gëtt SKILL.md gelies, d'Ressourcedateie gi gebëndelt an d'Resultat gëtt lokal gespäichert.

  1. Maacht d'App op a gitt op Plugins → Skills.
  2. Wielt „Vun GitHub installéieren“.
  3. Pecht d'URL vum Skill-Dossier hei drënner an a bestätegt.
    https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-profiling-and-optimization
  4. Aktivéiert de Skill an all Chat, an deem Dir e benotze wëllt.
Plugins → Skills → Skill afügen → Vu GitHub-URL, pecht dann d'URL vum Dossier an a klickt op Weider.
2

An engem anere KI-Agent installéieren

All KI-Agent, deen d'Format Agent Skills liest, kann dëse Skill benotzen — kopéiert den Dossier an de Skill-Verzeechnes vun deem KI-Agent.

Claude Code — .claude/skills
git clone --depth 1 https://github.com/kevinpbuckley/unreal-engine-skills.git /tmp/unreal-engine-skills
mkdir -p .claude/skills
cp -r /tmp/unreal-engine-skills/skills/core/ue-profiling-and-optimization .claude/skills/ue-profiling-and-optimization
Start Claude Code nom Kopéieren nei, fir datt den neie Skill erkannt gëtt.

An TypingMind benotzen

Aktivéiert Ue Profiling And Optimization an engem Chat vun TypingMind, an de Modell iwwerhëlt de Rescht. Den Numm an d'Beschreiwung stinn am System-Prompt. Soubal eng Ufro dozou passt, luet de Modell déi komplett Instruktioune selwer — Dir musst de Skill ni manuell opruffen, an et fale keng Token un, bis en tatsächlech benotzt gëtt.

De Modell luet Ue Profiling And Optimization automatesch, soubal eng Ufro dozou passt.

Funktionéiert mat all KI-Modell

KI-Skills si reng Markdown-Instruktiounen amplaz vun ubidderspezifeschem Code. Dofir ass Ue Profiling And Optimization net un de Modell gebonnen, fir deen de Skill geschriwwe gouf. Installéiert en eemol an TypingMind a benotzt e mat GPT-5, Claude, Gemini, Grok, DeepSeek, Mistral, Llama oder engem lokale Modell, deen Dir selwer bedreift — alles mat Ären eegenen API-Keys.

  • Gëtt nëmme gelueden, wann et néideg ass

    De System-Prompt enthält nëmmen den Numm an d'Beschreiwung. D'Instruktioune gi bei der éischter passender Ufro gelueden, soudatt en onbenotzte Skill näischt kascht.

  • De Modell am lafende Chat wiesselen

    Well de Skill aus Instruktiounen amplaz vu Code besteet, funktionéiert en och no engem Modellwiessel — den nächste Modell liest déi selwecht SKILL.md-Datei.

Skill-Instruktiounen

Dëst ass den Inhalt vu SKILL.md, deen de Modell luet. Liest e virun der Installatioun — e Skill besteet aus Instruktiounen, déi Äre Modell befollegt.

Profiling & optimization

Optimize by measurement, not guesswork: capture data, find the actual hotspot, fix it, re-measure. The three tool layers are Unreal Insights (deep trace-based profiling), the in-game stat commands (quick triage), and instrumentation macros for your own code. Start with stat commands to identify which thread owns the frame budget, then open Insights for a precise call-by-call view.

When to use this skill

  • Frame rate is low or hitching; determining whether the game thread, render thread, or GPU is the bottleneck.
  • Adding per-system timing so it appears by name in Insights and stat output.
  • Memory growth, out-of-memory events, or finding which system owns an allocation.
  • Deciding which optimization lever to pull after identifying the hotspot.

Triage first: stat commands

In the console (PIE or standalone game):

CommandWhat it shows
stat unitFrame / Game / Draw / GPU / RHIT split — the first command to run
stat fpsRaw frame rate
stat gameGame-thread breakdown by system
stat gpuGPU pass costs (requires -trace=gpu or GPU channel)
stat scenerenderingDraw-call counts, visible sections, render overhead
stat memoryPer-subsystem memory counters
stat streamingStreaming texture and asset memory
stat initviewsVisibility culling cost and visible section count
stat dumphitchesLog any hitch above t.HitchFrameTimeThreshold
stat startfile / stat stopfileCapture a .uestats file for legacy Session Frontend
stat llmLow Level Memory Tracker totals
stat lllmfullExpanded LLM counters per tag

Read stat unit first:

  • Game dominates → optimize C++ / Blueprint / tick overhead.
  • Draw dominates → reduce draw calls, draw-thread CPU cost.
  • GPU dominates → rendering budget, resolution, overdraw, shadows, post-process.
  • RHIT (RHI Thread) high → command-list heavy; reduce batching or RHI overhead.

See references/stat-commands.md for the full command table and per-command interpretation guidance.

Unreal Insights — the full profiler

Trace-based, low overhead, works in PIE and packaged builds. Produces .utrace files opened in Engine\Binaries\Win64\UnrealInsights.exe.

Starting a trace

From the Editor bottom toolbar — click Trace to open the Trace widget; select channels and click Start Trace. From the command line:

MyGame.exe -trace=cpu,gpu,frame,bookmark,log -tracehost=127.0.0.1

Channels of interest:

ChannelCaptures
cpuNamed CPU timers (TRACE_CPUPROFILER_EVENT_SCOPE, SCOPE_CYCLE_COUNTER)
gpuNamed GPU pass timers
frameGame/render frame markers
memallocEvery allocation + callstack (heavy — Development build only)
memtagLLM tag snapshots per frame (lighter)
bookmarkTRACE_BOOKMARK markers
statsStats-system counters
logUE_LOG output

Timing Insights window

Opens from the Session Browser. Key views:

  • Frames panel — bar chart of per-frame cost; click a spike to zoom in.
  • Timing panel — per-thread timeline of named CPU/GPU scopes, nested call hierarchy.
  • Timers tab — aggregated total/avg/max per named scope for the selected time range; sort by Inclusive Time to find the heaviest leaf callers.
  • Callers/Callees — trace who calls a selected scope and what it calls.

Memory Insights window

Opened from Menu > Memory Insights inside a trace that has memalloc or memtag active.

  • Timeline shows total allocated bytes, live allocation count, and LLM-tagged graphs.
  • Investigation panel runs queries: Active Alloc, Growth (A→B), Memory Leaks (A→B→C), Short Living, Long Living.
  • Results break down by LLM tag, callstack, asset name, or class name.

Full workflow: references/unreal-insights-and-trace.md.

Instrumentation — stat groups and cycle counters

The stat system shows named timers in stat <group> output and in Insights.

cpp
// In a .cpp (file scope — single translation unit):
DECLARE_STATS_GROUP(TEXT("MySystem"), STATGROUP_MySystem, STATCAT_Advanced);
DECLARE_CYCLE_STAT(TEXT("MySystem Update"), STAT_MySystemUpdate, STATGROUP_MySystem);

// In the function:
void UMySystem::Update()
{
    SCOPE_CYCLE_COUNTER(STAT_MySystemUpdate);
    // ... work ...
}

For a stat accessible across multiple files, declare with DECLARE_CYCLE_STAT_EXTERN in the header and DEFINE_STAT in the .cpp.

QUICK_SCOPE_CYCLE_COUNTER is a one-liner for temporary instrumentation — it creates and uses a cycle counter in STATGROUP_Quick with no prior declaration:

cpp
void AMyActor::Tick(float DeltaTime)
{
    QUICK_SCOPE_CYCLE_COUNTER(STAT_MyActor_Tick);
    // ... work ...
}

Instrumentation — CPU profiler trace scopes

TRACE_CPUPROFILER_EVENT_SCOPE writes directly to the Trace system (cpu channel) and is visible in the Timing Insights timeline. Lower overhead than the stat system; preferred for high-frequency scopes.

cpp
#include "ProfilingDebugging/CpuProfilerTrace.h"

void AMySystem::Step()
{
    TRACE_CPUPROFILER_EVENT_SCOPE(AMySystem::Step);
    // ... work ...
}

For a dynamic (runtime-determined) scope name use TRACE_CPUPROFILER_EVENT_SCOPE_TEXT:

cpp
TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(*DynamicName);

Scope variants (all in CpuProfilerTrace.h:453):

  • TRACE_CPUPROFILER_EVENT_SCOPE(Name) — literal token, lowest overhead.
  • TRACE_CPUPROFILER_EVENT_SCOPE_STR(NameStr) — const string pointer.
  • TRACE_CPUPROFILER_EVENT_SCOPE_TEXT(Name) — dynamic TCHAR*/FName.
  • TRACE_CPUPROFILER_EVENT_SCOPE_ON_CHANNEL(Name, Channel) — gated on a custom channel.

CPUPROFILERTRACE_ENABLED is 1 in Development/Test builds and 0 in Shipping.

Instrumentation — CSV profiler

CSV_SCOPED_TIMING_STAT records per-frame timings to a CSV file, usable in Shipping and Test builds. Useful for automated performance regression tests.

cpp
#include "ProfilingDebugging/CsvProfiler.h"

CSV_DEFINE_CATEGORY(MySystem, true);

void UMySubsystem::Tick(float DeltaTime)
{
    CSV_SCOPED_TIMING_STAT(MySystem, MySubsystem_Tick);
    // ... work ...
}

Full reference: references/instrumenting-cpp.md.

Memory profiling

Quick snapshot

memreport -full

Dumps a detailed memory breakdown to Saved/Profiling/MemReports/. Covers pool allocators, UObject counts, asset memory, texture streaming, etc.

LLM (Low Level Memory Tracker)

LLM instruments every allocation with a tag. Enable with -llm on the command line; view with stat llm, stat llmfull, or via Insights MemTag channel.

LLM tags are defined in LowLevelMemTracker.h (Runtime/Core/Public/HAL/LowLevelMemTracker.h). Tags relevant to games: UObject, RenderTargets, Shaders, Meshes, Audio, Animation.

Insights Memory Insights

Run with -trace=memalloc,memtag,callstack,module (Development build). Open Memory Insights from the Menu inside a loaded trace. Use "Memory Leaks" query to find allocations alive across a level transition, or "Growth" to find what grew between two moments.

Full workflow: references/memory-profiling.md.

GPU profiling

  • stat gpu — per-pass totals in the console.
  • ProfileGPU (console command) / GPU Visualizer (Editor menu) — one-frame GPU breakdown, shows pass tree with ms costs.
  • Insights GPU track — timeline view of GPU passes alongside CPU work; requires -trace=gpu.

Common GPU costs to investigate: shadow passes (stat shadowrendering), translucency overdraw, post-process stack, screen percentage, too many dynamic lights.

Common optimization levers (after measuring)

SymptomLever
Game thread high, many ticksDisable unnecessary ticking; use timers/events (ue-timers-and-async)
Blueprint hot pathMove heavy per-frame logic to C++
Draw thread highReduce draw calls: ISM/HISM instancing, fewer unique materials, merge meshes (ue-materials-and-shaders, ue-nanite-and-rendering)
GPU overdraw / fill rateReduce translucency layers, cull small objects, lower screen percentage
GC spikeReduce UObject churn; pool objects; tune GC settings (ue-memory-and-gc)
Memory growthAvoid hard references pulling large assets; stream assets async (ue-asset-management)
Streaming hitchesPrestream assets before they're needed; adjust streaming budget

Gotchas

  • Profiling in Development/Editor misleads on absolute timing; use Shipping-config packaged builds for final numbers. Use Development PIE for iteration.
  • Confusing CPU- and GPU-bound — fix the wrong side. Always read stat unit first.
  • TRACE_CPUPROFILER_EVENT_SCOPE with a string literal — use _STR variant instead; passing a quoted string to the plain macro adds extra quotation marks in the name.
  • DECLARE_CYCLE_STAT in a header — the static DEFINE_STAT it emits causes a linker duplicate if included in multiple TUs. Use the _EXTERN + DEFINE_STAT pair.
  • memalloc tracing at scale — capturing every allocation produces enormous traces; prefer memtag for long sessions and use memalloc only for targeted leak hunts.
  • Optimizing without measuring — always profile first; fixing a non-bottleneck wastes time and can obscure the real hotspot.
  • Stats stripped in Shipping — STATS is 0 in Shipping; use TRACE_CPUPROFILER_EVENT_SCOPE (disabled by CPUPROFILERTRACE_ENABLED) or CSV_SCOPED_TIMING_STAT (available in Test/Shipping) for production-visible metrics.

Version notes

  • Stats2.h is deprecated in 5.6 and redirects to Stats.h; include Stats/Stats.h.
  • CPUPROFILERTRACE_ENABLED evaluates to 0 in Shipping builds (5.8: CpuProfilerTrace.h:21).
  • Memory Insights Android callstack support was added in 5.4; available in 5.8.
  • Timing Insights gained a Verse Sampling track in 5.7.

References & source material

Engine source (UE 5.8, under Engine/Source/Runtime/Core/Public/):

  • Stats/Stats.h — DECLARE_STATS_GROUP:209, DECLARE_CYCLE_STAT:130, SCOPE_CYCLE_COUNTER:229, QUICK_SCOPE_CYCLE_COUNTER:226, DECLARE_SCOPE_CYCLE_COUNTER:221, CONDITIONAL_SCOPE_CYCLE_COUNTER:235.
  • Stats/Stats2.h — deprecated header; redirects to Stats/Stats.h since 5.6.
  • ProfilingDebugging/CpuProfilerTrace.h — TRACE_CPUPROFILER_EVENT_SCOPE:453, TRACE_CPUPROFILER_EVENT_SCOPE_STR:408, TRACE_CPUPROFILER_EVENT_SCOPE_TEXT:489, CPUPROFILERTRACE_ENABLED:21, FCpuProfilerTrace::FEventScope:185.
  • ProfilingDebugging/CsvProfiler.h — CSV_SCOPED_TIMING_STAT:120, CSV_DEFINE_CATEGORY:50, CSV_CUSTOM_STAT:155.
  • ProfilingDebugging/ScopedTimers.h — FDurationTimer:31, FScopedDurationTimer:65, FScopedDurationTimeLogger:193.
  • HAL/LowLevelMemTracker.h — ENABLE_LOW_LEVEL_MEM_TRACKER:19, LLM tag scopes.

Official docs (UE 5.8, fetched and confirmed live):

Deep-dive references in this skill:

Related skills: ue-nanite-and-rendering, ue-materials-and-shaders, ue-timers-and-async, ue-memory-and-gc, ue-debugging-techniques.

Matgeliwwert Fichieren

De Modell liest dës Dateie bei Bedarf, wärend de Skill gelueden ass. Si ginn als liesbar Dateie bereetgestallt a ginn ni ausgeféiert.

Heefeg gestallte Froen

Wat mécht de KI-Skill Ue Profiling And Optimization?

Profile and optimize Unreal Engine performance — Unreal Insights (trace-based CPU/GPU/memory profiling, .utrace sessions, Timing Insights, Memory Insights), stat commands (stat unit/fps/game/gpu/scenerendering/memory and the full stat command table), stat groups, C++ instrumentation (DECLARE_STATS_GROUP, DECLARE_CYCLE_STAT, SCOPE_CYCLE_COUNTER, QUICK_SCOPE_CYCLE_COUNTER, TRACE_CPUPROFILER_EVENT_SCOPE, CSV_SCOPED_TIMING_STAT), memory profiling (LLM, MemReport, memreport -full), and the measurement-first optimization workflow. Use when diagnosing frame-rate drops, hitches, CPU/GPU bottlenecks...

Firwat Ue Profiling And Optimization op TypingMind benotzen?

Well Dir en eemol installéiert a mat all Modell benotze kënnt. Ue Profiling And Optimization besteet aus einfachem Markdown amplaz vun ubidderspezifeschem Code. Dee selwechte Skill funktionéiert also mat GPT-5, Claude, Gemini, Grok oder engem lokale Modell – an Dir kënnt de Modell matzen am Chat wiesselen, ouni datt de Skill ophält ze funktionéieren. TypingMind benotzt Är eegen API-Schlësselen, sou datt Dir d'Ubidder direkt bezuelt amplaz vun engem Abonnement pro Benotzerplaz. Är Skills a Chats bleiwen an Ärem eegene Späicher.

Wéi installéieren ech Ue Profiling And Optimization an TypingMind?

Maacht an TypingMind Plugins → Skills → Vu GitHub installéieren op a setzt https://github.com/kevinpbuckley/unreal-engine-skills/tree/master/skills/core/ue-profiling-and-optimization an. TypingMind liest d'Datei SKILL.md, bündelt déi zougehéiereg Dateien an installéiert dat Ganzt als Skill, deen Dir pro Chat aktivéiere kënnt.

Wéi eng KI-Modeller kënnen Ue Profiling And Optimization benotzen?

All Modell, deen Dir an TypingMind verbënnt. KI-Skills sinn einfach Markdown-Instruktiounen an net ubidderspezifesche Code. Dofir kënne GPT, Claude, Gemini, Grok a lokal Modeller dëse Skill lueden, wann eng Ufro dozou passt.

Wéi vill KI-Modeller kann ech mat Ue Profiling And Optimization benotzen?

Esou vill Dir wëllt. Soulaang e Modell Skills ënnerstëtzt, kënnt Dir Ue Profiling And Optimization domat benotzen – GPT, Claude, Gemini, Grok, DeepSeek, Mistral, Llama a méi – alles op TypingMind mat Ären eegenen API-Schlësselen.

Ass de KI-Skill Ue Profiling And Optimization gratis?

De Skill gëtt vum kevinpbuckley op GitHub publizéiert. Kuckt am Repository no de Lizenzbedéngungen. Dir bezuelt nëmmen Ären eegene KI-Ubidder fir d'Token, déi Dir benotzt.

Wat si KI-Skills?

E KI-Skill ass e weiderverwendbaart Pak vun Instruktiounen, dat engem KI-Modell bäibréngt, wéi en eng bestëmmt Aufgab erfëllt. E follegt dem oppenen Agent Skills-Format: eng Datei SKILL.md mat engem Numm an enger Beschreiwung, plus all Scripten, Virlagen oder Referenzdateien, déi de Modell eventuell brauch. De Modell liest d'Instruktiounen eréischt, wann Är Ufro zum Skill passt. En installéierte Skill kascht also näischt, bis e benotzt gëtt.

Wéi ënnerscheede sech KI-Skills vu Plugins oder MCP-Serveren?

E Plugin oder MCP-Server gëtt engem Modell nei Tools, déi en opruffe kann – Code, deen iergendwou leeft an e Resultat zeréckgëtt. E KI-Skill gëtt dem Modell dogéint Wëssen an eng Virgoensweis: wéi en eng Aufgab ugeet, wéi eng Schrëtt en nokënnt a wéi eng gutt Ausgab ausgesäit. Skills bestinn aus einfachem Markdown, brauche kee Server, keen API-Schlëssel a keng Lafzäitëmfeld a funktionéiere mat all Modell.

All weisen

Elo Ären eegene KI-Workspace ariichten

Abonnéiert Iech op eisen Newsletter, fir iwwer nei Funktiounen an zukünfteg Gewënnspiller informéiert ze ginn 👇