demo · v134
console.timeStamp+
console.timeStamp() now takes a measurement (start/end label or absolute times) and presentation options (track, color). Custom traces show up on DevTools' Performance panel with their own track and colour. Configure a marker, click "emit", then open DevTools → Performance and start a recording.
probing console.timeStamp signature...
Try it
Open DevTools → Performance, hit record, then click "emit". You should see the marker on the track and colour you picked.
The code
// instant marker:
console.timeStamp("paint", { track: "Render", color: "secondary" });
// measurement with explicit endpoints:
const t0 = performance.now();
doWork();
console.timeStamp("paint", t0, performance.now(), "Render", "primary");
// or named start/end:
console.timeStamp("paint", "render-start", "render-end", "Render");