lag-detector

Sample the CPU program counter to identify hotspots and laggy routines.

Updated Dec 30, 2025
One-click install
npx skills add https://github.com/scawful/afs_scawful --skill lag-detector
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: lag-detector
Source: https://github.com/scawful/afs_scawful/tree/main/skills/lag-detector
Command: npx skills add https://github.com/scawful/afs_scawful --skill lag-detector

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Performance profiling and hotspot identification for code running in an Oracle of Secrets-like context, enabling targeted optimizations and smoother execution.

Core Features & Use Cases

  • Profile execution by sampling the CPU program counter to produce a heatmap of hotspots.
  • Identify bottlenecks by reporting top routines and their sample share.
  • Map hotspots back to ASM sources to streamline debugging and optimization.

Quick Start

Start profiling with lag-detector run --duration 10 to generate the hotspot heatmap.

Frequently Asked Questions about lag-detector

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

FAQPage Schema
How do I profile CPU hotspots to find laggy routines in my game code?

You can profile CPU hotspots by sampling the program counter over a set duration. This generates a heatmap of laggy routines, showing top routines and their sample share to pinpoint exactly where execution bottlenecks occur in your game or ROM code.

Can I map identified CPU hotspots back to ASM source code for debugging?

Yes, hotspot mapping correlates identified bottlenecks back to ASM sources. This source mapping streamlines debugging and optimization by linking program counter samples directly to their corresponding assembly instructions in the game or ROM code.

What is the best way to start profiling execution for real-time performance analysis?

Start profiling execution by running a sampling session with a set duration, such as ten seconds. This produces a hotspot heatmap and reports top routines by their sample share, enabling real-time performance analysis and targeted optimizations.

Does lag-detector work with ROM code contexts for bottleneck identification?

Yes, this profiling approach works with ROM code contexts for bottleneck identification. It targets hotspot analysis and source mapping specifically within game or ROM code by sampling the CPU program counter to reveal laggy routines.

Why does my game experience lag and how can I identify the specific routines causing it?

Games experience lag when specific routines consume excessive CPU cycles. You can identify these laggy routines by sampling the CPU program counter to produce a heatmap, which reports the top routines and their share of execution time for optimization.