Lag Detector

by scawful

code

Performance profiler for Oracle of Secrets. Samples the CPU Program Counter (PC) to identify code hotspots and laggy routines using statistical analysis.

Skill Details

Repository Files

1 file in this skill directory


name: lag-detector description: Performance profiler for Oracle of Secrets. Samples the CPU Program Counter (PC) to identify code hotspots and laggy routines using statistical analysis.

Lag Detector

Scope

  • Profiling: Statistical sampling of CPU execution.
  • Hotspot Analysis: Identify which routines consume the most cycles.
  • Source Mapping: Map hotspots back to ASM files.

Core Capabilities

1. Profile execution

  • run --duration 10: Sample CPU for 10 seconds.
  • Output: A heatmap of the most executed routines.

2. Identify Bottlenecks

  • "Routine Update_Sprites executed 5000 times (40% of samples)."
  • Helps pinpoint inefficient loops or heavy logic.

Workflow

  1. Setup: Navigate to a laggy area (e.g., room with many enemies).
  2. Profile: lag-detector run --duration 5.
  3. Analyze: "Top hotspot is Sprite_Draw in Sprites.asm."

Dependencies

  • Tool: ~/src/hobby/yaze/scripts/ai/profiler.py.
  • Mesen2: Running with socket server.
  • z3ed: For symbol resolution.

Example Prompts

  • "Profile the game for 10 seconds to find lag sources."
  • "What routine is taking up the most CPU time right now?"

Troubleshooting

  • No Hotspots: Ensure the game is not paused.
  • Unknown Symbols: Ensure the ROM has a valid .mlb or sourcemap.json.

Related Skills

Mermaid Diagrams

Comprehensive guide for creating software diagrams using Mermaid syntax. Use when users need to create, visualize, or document software through diagrams including class diagrams (domain modeling, object-oriented design), sequence diagrams (application flows, API interactions, code execution), flowcharts (processes, algorithms, user journeys), entity relationship diagrams (database schemas), C4 architecture diagrams (system context, containers, components), state diagrams, git graphs, pie charts,

artdesigncode

Matlab

MATLAB and GNU Octave numerical computing for matrix operations, data analysis, visualization, and scientific computing. Use when writing MATLAB/Octave scripts for linear algebra, signal processing, image processing, differential equations, optimization, statistics, or creating scientific visualizations. Also use when the user needs help with MATLAB syntax, functions, or wants to convert between MATLAB and Python code. Scripts can be executed with MATLAB or the open-source GNU Octave interpreter

codedata

Dask

Distributed computing for larger-than-RAM pandas/NumPy workflows. Use when you need to scale existing pandas/NumPy code beyond memory or across clusters. Best for parallel file processing, distributed ML, integration with existing pandas code. For out-of-core analytics on single machine use vaex; for in-memory speed use polars.

codeworkflow

Consult Zai

Compare z.ai GLM 4.7 and code-searcher responses for comprehensive dual-AI code analysis. Use when you need multiple AI perspectives on code questions.

code

Writing Effective Prompts

Structure Claude prompts for clarity and better results using roles, explicit instructions, context, positive framing, and strategic organization. Use when crafting prompts for complex tasks, long documents, tool workflows, or code generation.

codedocumentworkflow

Analyze Performance

Establish performance baselines and detect regressions using flamegraph analysis. Use when optimizing performance-critical code, investigating performance issues, or before creating commits with performance-sensitive changes.

code

Flowchart Creator

Create HTML flowcharts and process diagrams with decision trees, color-coded stages, arrows, and swimlanes. Use when users request flowcharts, process diagrams, workflow visualizations, or decision trees.

artcodeworkflow

Bio Reporting Rmarkdown Reports

Create reproducible bioinformatics analysis reports with R Markdown including code, results, and visualizations in HTML, PDF, or Word format. Use when generating analysis reports with RMarkdown.

code

Desmos Graphing

Create interactive Desmos graphs in Obsidian using desmos-graph code blocks. Use when visualizing functions, parametric curves, inequalities, or mathematical relationships with customizable styling and settings.

code

Performance

Rendimiento & Optimización - Atoll Tourisme. Use when optimizing performance or profiling code.

code

Skill Information

Category:Technical
Last Updated:1/28/2026