Skip to content
Back to skills

Godot Profiling

ASecurity

Measure a Godot game: frame and physics time, Performance and custom monitors, headless timing, before and after numbers for a change.

  • 5 stars
  • 0 votes
  • 0 copies
  • 0 views
  • Added December 3, 2026
ai-agentspythongobashnodeawsperformance

Works with

  • cli

Security analysis

A100/100

Pro scans all 6 files and shows the line behind each finding

Scanned December 3, 2026

npx -y skills add tipoLi5890/game-studio --skill godot-profiling --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Godot Profiling?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Godot Profiling
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/tipoli5890-godot-profiling/badge)](https://www.skillsdirectory.com/skills/tipoli5890-godot-profiling)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: godot-profiling
description: >-
  Measure a Godot game: frame and physics time, Performance and custom monitors, headless timing,
  before and after numbers for a change.
---

# godot-profiling — numbers before and after

A change is faster when two runs of the same moment say so, not when a frame counter looks better
once. Sample a window of frames with the same clock, several windows per side, and compare against
the noise the windows themselves show.

## Load what the situation needs

| The situation | Read |
|---|---|
| "Is it faster now?"; a before and after table for a change | the method below, then `reference/method.md` |
| What `TIME_PROCESS`, `TIME_FPS`, the object and render monitors mean; why a monitor reads 0 | `reference/monitors.md` |
| A game number on the monitor list (parcels in play, sentries awake) | `reference/monitors.md` → "Custom monitors" |
| `--benchmark-file`, `--print-fps`, `--profiling` | `reference/monitors.md` → "Command-line options" |
| Timing one function | `reference/method.md` → "Time one function" |
| Frame cost at a moment reached by a journey | `reference/method.md` → "Inside a journey", and `godot-play-harness` |
| Rendering cost: lights, shadows, materials, draw order | `godot-rendering-3d`, `godot-2d-rendering` |
| Is the change correct, not just fast | `godot-verify` |

## The method

1. Copy `resources/perf_sampler.gd` to `res://perf/perf_sampler.gd`.
2. Sample the same scene before and after the change, three windows each:

```bash
python3 scripts/perf_run.py --project . --scene res://rooftop_route.tscn --out /tmp/perf/before.json --repeat 3
python3 scripts/perf_run.py --project . --scene res://rooftop_route.tscn --out /tmp/perf/after.json --repeat 3
python3 scripts/compare_runs.py --before /tmp/perf/before-1.json /tmp/perf/before-2.json /tmp/perf/before-3.json \
    --after /tmp/perf/after-1.json /tmp/perf/after-2.json /tmp/perf/after-3.json --max-regress frame_usec:10
```

3. Report the sentence with numbers, the table, and what the run could not measure.

`perf_run.py` runs `godot --headless -l en --path . --fixed-fps 60 --quit-after N -s
res://perf/perf_sampler.gd -- --scene=... --warmup=120 --frames=600 --out=...` under a wall-clock
timeout. It passes when every run prints `PERF_DONE` with no marker line and exit 0; it fails on a
marker, `PERF_ERROR`, or a crash, including a crash after `PERF_DONE`; no binary, a timeout or no
sentinel is `UNVERIFIED` (3).

## What a headless window measures

| Number | Means |
|---|---|
| `frame_usec` (the sampler's own) | wall time between process frames; under `--fixed-fps` the loop is not throttled, so this is the CPU cost of a frame. The number to compare |
| object, node, orphan and resource counts | exact every frame, the same on any machine: the deterministic regression check |
| `TIME_PROCESS`, `TIME_PHYSICS_PROCESS`, `TIME_FPS` | refreshed once per wall-clock second; `TIME_PROCESS` is the slowest frame of that second. A 600-frame fixed-step window lasts well under a second, so they still read 0.0 and 1.0 |
| render monitors | 0: the dummy renderer draws nothing |
| `custom:<id>` | every custom monitor the scene registered |

Headless is CPU only. GPU time, draw calls and video memory need a windowed run on a desktop
session, which this skill does not check.

## compare_runs.py

| Rule | Holds when |
|---|---|
| `--max-regress MON:PCT` | after is at most PCT% above before, or above it only within the noise (printed as a `NOTE`) |
| `--expect-drop MON:PCT` | after is at least PCT% below before and the drop is larger than the noise; needs two or more windows per side |
| `--budget MON:VALUE` | every after window's p95 is at most VALUE |

Each window gives one number per monitor (the median of its frames by default); each side is the
median of its windows; the noise is the larger side's spread. Windows of different scenes, frame
counts, warm-ups, displays or fixed steps are refused, and so is a `time_*` rule from a window
shorter than 2 s of wall time. Exit 0 every rule held, 2 a rule broke or a named monitor is
missing, 3 a file is unreadable, 1 usage or refused input.

## Discipline

- **One clock per comparison.** `frame_usec` under `--fixed-fps` for CPU work; never a real-time
  headless run, where frames wait on the loop and the number measures pacing.
- **Warm up.** The first frames pay for loading and first allocations; `--warmup` (default 120)
  keeps them out of the window.
- **Several windows, the same machine, nothing else heavy running.** One window per side cannot
  separate a change from noise, and `--expect-drop` refuses it.
- **Counts before times.** A node count that grew is a fact on every machine; a time that grew 4%
  may be the room getting warmer.
- **Remove custom monitors in `_exit_tree()`.** A lambda left registered crashes the engine at quit
  after the run has printed its sentinel, sometimes with no marker line; only the exit code shows
  it.
- **Say what was not measured.** A headless table says nothing about the GPU.

## Scope — what this skill does NOT do

| Not here | Go to |
|---|---|
| Driving the game into a moment, timelines, invariants | `godot-play-harness` |
| The verdict on a change, markers, exit codes | `godot-verify` |
| 3D rendering cost and settings | `godot-rendering-3d` |
| 2D draw order, lights and shaders | `godot-2d-rendering` |
| Running Godot from scripts in general | `godot-cli` |

Files in this skill

  • SKILL.md5.3 KB
  • reference/method.md6.1 KB
  • reference/monitors.md4.6 KB
  • resources/perf_sampler.gd5.3 KB
  • scripts/compare_runs.py15 KB
  • scripts/perf_run.py13.6 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

View all in ai-agents →

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.