Skip to main content
Journey Uncommon Logo
JourneyUncommon
mediumNodeJSperf_hooks timingSingle-choice MCQ

Using perf_hooks, you mark two points and measure between them. The handler below logs the duration. Which API call correctly produces a PerformanceEntry whose duration is the elapsed time between the two marks?

const { performance, PerformanceObserver } = require('node:perf_hooks'); const obs = new PerformanceObserver((list) => { for (const e of list.getEntries()) console.log(e.name, e.duration); }); obs.observe({ entryTypes: ['measure'] }); performance.mark('start'); // ... work ... performance.mark('end'); // ??? <- which call here?