Skip to content

API reference ​

myaku(options?) ​

Starts profiling and returns the Profiler. If one is already running (window.__MYAKU__), returns that one.

OptionDefault
size600Frames kept
budgetMs1.5× the display's frame intervalSlower frames are hitches
contextstrueCount draws, uploads and compiles on canvas contexts
globaltrueExpose as window.__MYAKU__
enginestrueAdd engine spans automatically (details)

import "myaku/auto" ​

Starts the profiler and shows the overlay.

Profiler ​

report()A Report for the frames in the buffer
hitches()Every slow frame in the buffer as a Verdict, oldest first
explain(ago = 0)A Verdict for one frame (0 = the latest)
frame(ago = 0), frames(count?)Raw Frames
span(name, fn)Time fn under name; returns what fn returns
begin(name)Start a span; call the returned function to end it
addSpan(name, ms)Add measured time to a span
subscribe(fn)Call fn after every frame; returns an unsubscribe function
stop()Restore everything myaku wrapped
budgetMs, displayIntervalMs, overheadMs, length, size, supportProperties

adapt(profiler, game) ​

Adds engine spans for a Phaser Game, a PixiJS Application or a three.js renderer. Returns "phaser", "pixi", "three" or undefined.

overlay(profiler, options?) ​

Shows the corner graph. Options: corner ("top-right" by default) and parent. Returns { element, toggle(visible?), destroy() }.

Frame ​

index, at, intervalMs, cpuMs, draws, uploads, uploadBytes, compiles, heapDropBytes, spans.

Verdict ​

frame, at, intervalMs, budgetMs, cause, confidence, summary, hint, where? (source, fn, line?, char) and evidence. See Reading verdicts.

Report ​

frames, seconds, fps, budgetMs, displayIntervalMs, intervalMs (p50, p95, p99, max), cpuMs (p50, p95, max), hitches, hitchesPerMinute, causes, worst, spans, perFrame, overheadMs, support. See Reports.