Skip to content

Bottleneck profiling instrumentation #1

Description

@HritwikSinghal

Tracking issue for the in-emulator profiling instrumentation added to this fork to find performance bottlenecks (goal: BOTW 4K60 on an Intel Panther Lake B390 iGPU, Mesa ANV, Linux).

What was added

  • Stats framework (LattePerformanceMonitor.h/.cpp): 15 nesting-safe TSC timers + 18 per-frame counters under performanceMonitor.bottleneck, with LATTE_PERF_SCOPE / LATTE_PERF_COUNT / LATTE_PERF_ADD macros. Commit 715c8fa.
  • Latte core call sites (command processor idle spin, guest fence waits, draw-sequence-end causes, index cache hit/miss, buffer sync, shader/FBO/texture timers, texture reload counts, emulated vsync lateness). Commit 110c070.
  • Vulkan call sites + GPU timestamps (first/fast draw counters, uniform/pipeline/descriptor/renderpass/submit timers, async-compile skips, forced submits, GPU-wait buckets, and per-command-buffer GPU busy time via TOP/BOTTOM_OF_PIPE timestamp query pairs read back on fence retirement). Commit fdbe9e9.
  • Overlay panel: 'Bottleneck stats' section in the debug overlay (per-frame values incl. GPU busy ms).
  • CSV dump: set CEMU_PERFSTATS_CSV=/path/file.csv to log one row per frame for offline analysis.

Toggle / overhead

Collection is gated by a single runtime flag: enabled while Options > General settings > Graphics > Overlay > Debug is checked (or while a CSV dump is active). When off, every call site costs one predictable branch. When on: two TSC reads per timed scope plus 2 GPU timestamps per command buffer.

How to read it

  • GPU busy vs frame time -> GPU-bound vs CPU-bound.
  • SeqEnd tex/ctxReg -> how often draw sequences break (validates the dirty-flag optimization thesis).
  • IdxCache hit/miss -> index cache effectiveness.
  • Waits: gpu/idleSpin/guestFence -> stall buckets on the GPU emulation thread.

Optimizations driven by this data are tracked separately.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions