methodology-measure

Measures and validates z88dk library changes using z88dk-ticks cycle counts, hotspots, and benchmarks.

1.1k|206|Updated Mar 16, 2016
One-click install
npx skills add https://github.com/z88dk/z88dk --skill methodology-measure-z88dk
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: methodology-measure
Source: https://github.com/z88dk/z88dk/tree/main/.agents/skills/methodology-measure
Command: npx skills add https://github.com/z88dk/z88dk --skill methodology-measure-z88dk

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? When optimizing z88dk library code for 8085, 8080, or gbz80 targets, developers need a rigorous way to prove what is slow, what changed, and what is correct. This Skill provides the measurement methodology: cycle-accurate timing with z88dk-ticks, hotspot profiling, map/nm link verification, A/B library swaps, and correctness gates via the math test suites. ## Core Features & Use Cases - Cycle-Accurate Timing: Use z88dk-ticks with TIMER_START/TIMER_STOP labels and map files to get exact T-state counts for timed regions, avoiding wall-clock noise. - Hotspot Profiling: Capture PC histograms via the ticks debugger (hotspot on) and aggregate cycles by symbol, source file, or library category to find where time is actually spent. - A/B Library Validation: Swap a single .asm file, rebuild the affected libraries (math32, math16, crt0), verify binary identity with cmp/md5sum, and confirm symbol linkage via map files and z88dk-z80nm. - Correctness Gates: Run test/suites/math targets (test_math32_8085.bin, test_math16.bin, etc.) before publishing benchmark numbers. - Use Case: After rewriting a 32-bit division routine for the 8085, rebuild math32_8085.lib, run the math suite to 16/16 passing, then remeasure the fasta benchmark ticks and confirm via the map that l_long_div_0 is actually linked before claiming a 5% improvement. ## Quick Start Ask the AI to measure the cycle count of a z88dk benchmark using z88dk-ticks with TIMER labels and an 8085 CPU model, then show the top hotspots by symbol.

Frequently Asked Questions about methodology-measure

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

FAQPage Schema
How do I measure cycle counts for z88dk library code?

Use z88dk-ticks with TIMER_START and TIMER_STOP labels in your C code, compile with -DTIMER and a map file, then run z88dk-ticks with -start TIMER_START -end TIMER_STOP and a large -counter value. The output is a single integer of T-states between the labels.

How do I find where time is spent in a z88dk binary?

Run z88dk-ticks with -debug and enable 'hotspot on', then break at TIMER_STOP and quit. This writes a hotspots file with hit counts and cycle sums per PC, which you sort by cycles and aggregate to symbols using the map file.

Why does z88dk-ticks stop at 100000000 and print a bare number?

The default -counter limit is 1e8 T-states, so long runs like n-body with n>=125 stop mid-execution and print the cap value. Pass -counter 999999999999 to allow the full run to complete.

How do I verify a library change actually affected my benchmark?

Check the map file or z88dk-z80nm output to confirm the suspect symbol is linked into the timed binary, then compare binaries with cmp or md5sum. Identical binaries mean the patch cannot affect TIMER results.

What must I rebuild after editing a shared math32 assembly file?

Shared files like asm/z80/d32_fsadd.asm are assembled into every math32 product (math32.lib, math32_z80n.lib, math32_z180.lib, etc.), so you must force-rebuild each product that lists the object and reinstall all of them into lib/clibs/.

Why does a math16 benchmark show most cycles in fsdiv instead of f16_div?

Linking with both --math16 and --math32 selects IEEE32 mode and pulls in math32 division, polluting the math16 measurement. Use pure --math16 with casted literals and verify __code_fp_math32_size is zero in the map.