Every run of the emulator profiles itself, frame by frame, and draws a flamegraph of where the time went. You do not have to set anything. A contributor who wants to work on performance starts from the folder of their own run.
At start the emulator creates a folder named by the date and the time of the run, in _FrameProfile of its working directory (next to _kyty.txt, _Shaders and _PipelineCache, when those exist), and says so in the log:
[kyty-frame-profile] on: one line per flip in .../_FrameProfile/2026-12-02_10-00-00/frames.jsonl, GPU busy time on every frame and per operation on one frame in 30, partial lines every 2000 ms; flame.svg and report.md are rewritten in .../_FrameProfile/2026-12-02_10-00-00 every 30 s and at exit
| File | What it is | Written |
|---|---|---|
frames.jsonl |
One JSON line per flip, plus a "partial":true line every 2 s without a flip. The source of everything else |
Continuously |
flame.svg |
The flamegraph of the whole run. Open it in a browser | Every 30 s and at exit |
frames.folded |
The same stacks as text (path microseconds), for speedscope or any other flamegraph tool |
Every 30 s and at exit |
report.md |
A short report: frame rate, frame time percentiles, stage shares, waits, counters, the worst frames | Every 30 s and at exit |
summary.json, report.md, frame-profile.txt |
The full report, from python3 tools/frame-profile.py <folder>. It overwrites the short report.md |
On demand |
Neither Python nor any other tool is needed for flame.svg, frames.folded and the short report.md: the emulator writes them itself, at a clean exit and every 30 s while it runs, so a crash or a kill leaves files at most 30 s old. A file is written whole under a temporary name and then renamed, so a viewer never reads a half-written one. The numbers cover the whole run even when frames.jsonl has been rotated.
frames.jsonltakes about 6 KB a frame. At 64 MiB it rotates toframes.1.jsonland starts again, so a run keeps at most the last 64 to 128 MiB of lines.- The emulator keeps the 10 newest run folders, this one included, and deletes the older ones when it starts. It also deletes the oldest ones past 2 GiB in all. A folder written to in the last minute is never deleted, so two emulators started in the same folder do not remove each other's run. Only folders named like
2026-12-02_10-00-00are touched. KYTY_FRAME_PROFILE_KEEP=<n>keepsnruns;0keeps every run and sets no size limit.
| Setting | Effect |
|---|---|
KYTY_FRAME_PROFILE=0 (or off, false, no, none) |
No profile, no folder. The cost falls to one branch per stage |
KYTY_FRAME_PROFILE=<folder> |
Writes into that folder as it is: no date folder, no deletion, frames.jsonl rotating at 256 MiB |
KYTY_FRAME_PROFILE_GPU_EVERY=<n> |
Splits the GPU time by operation on one frame in n (30 by default); 0 turns GPU timestamps off. Every frame is still timed as a whole |
KYTY_FRAME_PROFILE_KEEP=<n> |
Run folders kept, see above |
The GPU detail is sampled on purpose: a timestamp after every command keeps the GPU from overlapping commands and can double the GPU time. The default timestamps a barrier or a render pass edge on one frame in 30, and only times the command buffers on the others.
The live window is not started with the emulator. Open it on the folder of a run, while the title runs or after it, from the repository root:
python3 tools/frame-live.py _FrameProfile/2026-12-02_10-00-00
python3 tools/frame-live.py _FrameProfile/2026-12-02_10-00-00 --pid <process id>
python3 tools/frame-live.py _FrameProfile/2026-12-02_10-00-00 --replay --speed 4 --from 120On Windows use python tools/frame-live.py "C:\path\to\_FrameProfile\2026-12-02_10-00-00". It needs Python 3.9 or newer with Tkinter. The window never takes the keyboard focus from the title.
| Option | Effect |
|---|---|
--pid <process id> |
Closes the window when that process ends |
--replay |
Plays a finished run back at the pace it was recorded, from the frame times in frames.jsonl, instead of showing its last frame at once |
--speed <n> |
Replay speed, 1 by default |
--from <seconds> |
Starts the replay that many seconds into the run; the frames before it are read at once |
--size <width>x<height> |
Window size, for example 1280x720; by default it nearly fills the screen |
The window is one page with no scrollbar. Every panel, row and column keeps its place and size from one frame to the next; only the numbers change. A list always has the same number of rows, with empty rows when there is less to show, and a thread or a counter that is absent stays in its row, greyed, with —. The layout changes only when the window is resized: below 1600×900 the text is 12 px, above it 13 px.
- Header: the run folder, then the whole run so far: presented frames (and the frame not presented yet), median and p90 frame time, frames per second over the run, run length and GPU busy share. These are the numbers
tools/frame-profile.pyputs insummary.json. On the right: live, replay position, or the frame that has not been presented for how long. - Current frame: the time of the newest frame, in red when it waited on a compile or is not presented yet; the operation still open and where the stage thread is now, when the frame is not presented; and the frame rate over the frames that started in the last 5 s.
- Frame time: the last 60 s on a fixed logarithmic scale from 5 ms to 60 s, so a 33 ms frame and a 20 s stall are both readable. A red bar is a frame that waited on a compile, or the frame not presented yet. A frame longer than 60 s is cut at the top with its time written above it. The dashed line is 33 ms.
- Threads: one row per thread kind, always in the same order. The bar is the thread's time in the frame, summed over its threads: Kyty stages in blue, waits on the GPU, a label or a readback in amber, compile waits in red, idle in grey, and the empty part time outside any Kyty stage (the title's own code for the game threads). Compile threads record no stages, so their bar is their CPU time. The columns are CPU time, CPU time as a share of the thread time (frame time times the number of threads), and the idle share.
- Stages: the eight longest stages of the stage thread (
execute) in this frame, with their time and share of the frame. - Counts: the fifteen counters of the frame, always in the same order. A non-zero skipped, fallback, null image, compile wait or pipeline miss is red.
- Top waits: the three longest named waits of the frame, with their thread, time and share of the frame, and one line for the queue submits and their main reasons.
- GPU: the busy time of the newest timed frame, its command buffers, and the newest frame timed per operation (one frame in 30 by default) with its own busy time split by operation and its longest operation. The split always belongs to the frame named on its row. A shader hash of 0 is not shown: the operation kind is.
- Compiles and failures: blocking compiles and their time, background compiles and driver time, shader translations, skipped operations, fallbacks and null images, and the longest blocking compile.
- Memory and title: RAM, VRAM against its budget, the guest memory mirror, pipelines, and the title's submits, flips and flips behind.
- Five worst frames: the longest frames so far, with their longest stage and longest wait.
Times are in ms below one second and in s above, with one decimal. Shares are in %, with one decimal.
flame.svg answers "where does a frame's time go". It is one file that works offline in any browser: open it, hover, click and search, with nothing to install. The emulator and tools/frame-profile.py draw the same file, byte for byte.
The header gives the run: presented frames (and frames never presented), median and p90 frame time, frames per second, run length and GPU busy share, the same numbers as summary.json.
Each box is a stage; the box above it is a stage called from it. The bottom row, all threads, holds every thread kind, and the row above it the thread kinds. A box is as wide as its time, and its label reads execute · 770 ms/frame · 19.5 %:
- ms/frame is the box's time over the whole run divided by the frames (presented, plus the one not presented when the run stopped in a frame);
- % is that time as a share of the frame time, summed over the run;
- the run total, in ms, is in the tooltip.
Threads run in parallel, so the thread rows add up to more than the frame: compare a box with its own thread, not with another one. A label that does not fit is shortened at a word with …, and a box too narrow for any word has no label: hover it.
The colors have a meaning, shown in the legend at the top:
| Color | Meaning |
|---|---|
| Purple | The title's own threads, and any thread Kyty does not name (game threads) |
| Indigo | Kyty command processor (guest), which runs the guest command buffers |
| Sky blue | Kyty execute: draws, dispatches and callbacks |
| Teal | Kyty resolve |
| Green | Kyty record: replays the recorded commands into Vulkan |
| Lime | Kyty submit: hands command buffers to the GPU queue |
| Pink | Kyty guest memory mirror |
| Amber | Waiting on the GPU, a label or a readback |
| Red | Shader translation or pipeline compile, and waiting for one: the stutter to hunt |
| Grey | Idle or unclassified time: not a cost |
A submit, resolve, replay or mirror stage takes the color of that Kyty stage, whatever thread it runs on; any other stage that is not a wait, a compile or idle takes the color of its thread. Within a parent, the largest box comes first and idle comes last, in grey.
- Hover a box for its full path, ms/frame, share of the frame, run total and what its color means.
- Click a box to zoom: it and its parents take the whole width, and its children are spread over it. Click the bottom row, press Esc or use Reset zoom to come back.
- Hide idle removes idle time everywhere, so the rest takes the width; the numbers are then the time without idle. Show idle brings it back.
- Search (press
/) takes a name or a regular expression, such ascompileorwait_(gpu|label). Matching boxes are highlighted, the others dimmed, and the line beside the buttons gives how many boxes match and their time per frame and share of the frame, counting a match inside another match once. - Boxes narrower than half a pixel are not drawn;
frames.foldedlists every stack.
A wide execute;idle is the GPU thread waiting for work, which is not a cost. A wide execute;wait_gpu means the CPU is waiting for the GPU: look at the GPU time in report.md before optimizing CPU code. frames.folded also opens in speedscope.
rendering: no skipped operations or null images observed; image correctness is not checked
frame profile of 2026-12-02_10-00-00: 3600 frames in 61.2 s (58.8 fps)
wall_ms mean 17.0 p50 16.7 p90 18.1 p99 24.3 max 91.2
gpu busy ms: 120 frames, mean 11.2, p50 11.0, max 14.9
stage shares of wall time (flipping thread):
...
- rendering is the first line on purpose.
failedmeans operations were skipped or images were null: a frame rate then does not measure a working render. The report never says the image is right. - wall_ms is the time between two flips.
p99andmaxfind stutter that the mean hides. - gpu busy ms is the time the GPU worked, on the frames that were timed. If it is close to
wall_ms, the GPU is the limit; if it is far below, the CPU is. - stage shares is where the flipping thread spent the wall time. The stages are listed below.
- named waits are the stages that are waiting, not working.
- worst frames gives the frame number and the stage that dominated it. Find the same number in
frames.jsonlfor the full detail. - The full report from
tools/frame-profile.pyadds the waits by thread and by context, why each submit left, the costliest shaders, the null images with their formats and the pipeline compiles after startup.
A stage is time on one thread. Stages nest: a tables stage inside prepare_bindings inside dispatch.
| Stage | What the thread is doing |
|---|---|
idle |
Waiting for work: not a cost |
draw, dispatch, callback |
Running a guest draw, compute dispatch or host callback; its children say where |
pipeline_lookup |
Finding the host pipeline for a draw or dispatch |
compile_wait |
Blocked until a pipeline is compiled. Any time here is a stutter |
prepare_bindings, tables |
Resolving the shader's resources and the slots of its bindless tables |
bind_images, bind_buffers, image_heap |
Binding images and buffers; rebinding the bindless image heap |
commit, descriptor_writes, reset_bindings |
Writing and committing the descriptor sets |
barriers |
Recording pipeline barriers |
flush, submit, replay |
Closing a command buffer, handing it over, replaying the recorded commands into Vulkan |
queue_lock, vk_submit |
Waiting for the queue lock, then inside vkQueueSubmit |
wait_gpu |
Waiting for the GPU to finish a submission. The CPU is ahead of the GPU |
wait_ops, wait_copies, wait_mirror |
Waiting for priority operations, host copies or the guest memory mirror |
wait_label, wait_flip |
The guest waiting for a label the GPU writes, or for a free flip slot |
readback |
Reading GPU memory back for the CPU. Often followed by a wait_gpu |
label, flip, sync, query, eop |
Handling the guest's labels, flips, synchronization, queries and end-of-pipe writes |
writeback, upload, stream, evict, unmap, fault, guest_flush |
Moving data between guest and host memory, evicting it, and page fault handling |
mirror, parse, resolve |
The mirror thread, the parse of guest command buffers and the resolve thread |
A wait that happens inside one of the context stages (readback, label, flip, sync, query, eop, writeback, fault, unmap, evict, upload, stream, guest_flush, mirror) is counted under that context in the waits of the full report: a wait_gpu in readback is a CPU readback of something the GPU had not finished.
Measured by kyty_shim_frame_profile_report_tests <scratch folder> bench, a CPU-only micro-benchmark (no title, no GPU) on a Ryzen 9 7950X3D with other builds running, three runs:
| Item | Off (KYTY_FRAME_PROFILE=0) |
On |
|---|---|---|
One stage (KYTY_FRAME_STAGE, enter and leave) |
0.2 ns | 15 ns |
| One counter increment | 0.2 to 0.3 ns | 1.4 to 1.9 ns |
| One draw or dispatch operation record | 23 to 26 ns | |
End of a frame (EndFrame, 13 threads attached) |
0 | 9 to 18 µs median, 12 to 21 µs mean |
| Writer thread (formats the line, updates the report), on another core | 0 | 89 to 124 µs a frame |
Writing flame.svg, frames.folded and report.md (288 stacks, 20,000 frames) |
0 | 0.7 to 1.3 ms, every 30 s |
The game's own threads pay for the stages and the counters they pass through, and the thread that flips pays for EndFrame. With about 12 stages and 8 counters per draw or dispatch (an estimate from the code, not a count), a frame costs about 15 µs + 0.2 µs × operations:
| Draws and dispatches in a frame | Cost on the game's threads | Share of a 16 ms frame |
|---|---|---|
| 100 | 35 µs | 0.2 % |
| 300 | 75 µs | 0.5 % |
| 600 | 135 µs | 0.8 % |
| 880 | 190 µs | 1.2 % |
The limit of 1 % (160 µs) is about 725 operations a frame. Recent runs of a heavy title counted 100 to 450 draws and 135 to 425 dispatches a frame, with the heaviest frames at about 880 operations in all. The writer thread's 0.1 ms a frame is on another core and does not delay the game, but it is CPU: on a machine with no spare core it counts too. Idle, the writer wakes every 5 ms and takes about 1 % of a core. The file takes about 3 to 6 KB a frame. If the cost matters to you, KYTY_FRAME_PROFILE=0 removes all of it.
- Say what you ran (the build, the host, the GPU) and what you saw. Do not name the title; say "a title".
- Attach
report.mdandflame.svgfrom the run folder. They hold stage names, times and counters, no path and no user name. GitHub shows an attached.svgonly as a download: open it in a browser. - If asked for more, zip the folder:
frames.jsonlcompresses to about a tenth of its size. It holds shader hashes, memory sizes and the causes of skipped operations, no file paths. Read the log line at the top of the run before you share, as you would any log. - Run
python3 tools/frame-profile.py <folder>first if you can: itsreport.mdis the full one.
To compare two runs, compare their report.md and look at the same stage in both flamegraphs. A different scene gives a different profile: say which scene both runs reached. See performance bisect for how to attribute a change to a commit.