// Auto-generated by scripts/gen_parity_tests.py from docs/runtime-parity.md.
// Module: node:perf_hooks
// This file is a byte-for-byte parity test against `node --experimental-strip-types`.
// Edit the TODO lines below to exercise each API; rerun
// `./run_parity_tests.sh --filter test_parity_perf_hooks` to verify.

import * as perf_hooks from "node:perf_hooks";


// ── performance Methods ──
try {
  const now = perf_hooks.performance.now();
  console.log("performance.now typeof:", typeof now);
  console.log("performance.now positive:", now > 0);
} catch (e) {
  console.log("performance.now error:", (e as Error).message);
}

try {
  console.log("performance.timeOrigin typeof:", typeof perf_hooks.performance.timeOrigin);
} catch (e) {
  console.log("performance.timeOrigin error:", (e as Error).message);
}

try {
  console.log("performance.mark typeof:", typeof perf_hooks.performance.mark);
  console.log("performance.measure typeof:", typeof perf_hooks.performance.measure);
  console.log("performance.clearMarks typeof:", typeof perf_hooks.performance.clearMarks);
  console.log("performance.clearMeasures typeof:", typeof perf_hooks.performance.clearMeasures);
  console.log("performance.clearResourceTimings typeof:", typeof perf_hooks.performance.clearResourceTimings);
} catch (e) {
  console.log("performance methods typeof error:", (e as Error).message);
}

// ── mark / measure / getEntries ──
try {
  perf_hooks.performance.clearMarks();
  perf_hooks.performance.clearMeasures();
  perf_hooks.performance.mark("mark-a");
  perf_hooks.performance.mark("mark-b");
  perf_hooks.performance.measure("a-to-b", "mark-a", "mark-b");
  const entries = perf_hooks.performance.getEntries();
  console.log("getEntries length>0:", entries.length > 0);
  const byName = perf_hooks.performance.getEntriesByName("mark-a");
  console.log("getEntriesByName length>0:", byName.length > 0);
  if (byName.length > 0) {
    console.log("entry.name:", byName[0].name);
    console.log("entry.entryType:", byName[0].entryType);
    console.log("entry.startTime typeof:", typeof byName[0].startTime);
    console.log("entry.duration typeof:", typeof byName[0].duration);
  }
  const byType = perf_hooks.performance.getEntriesByType("mark");
  console.log("getEntriesByType length>0:", byType.length > 0);
  perf_hooks.performance.clearMarks();
  perf_hooks.performance.clearMeasures();
  console.log("clearMarks/clearMeasures ok");
} catch (e) {
  console.log("mark/measure/getEntries error:", (e as Error).message);
}

// ── performance.toJSON / nodeTiming ──
try {
  const j = perf_hooks.performance.toJSON();
  console.log("toJSON typeof:", typeof j);
} catch (e) {
  console.log("toJSON error:", (e as Error).message);
}

try {
  const nt = perf_hooks.performance.nodeTiming;
  console.log("nodeTiming typeof:", typeof nt);
} catch (e) {
  console.log("nodeTiming error:", (e as Error).message);
}

// ── eventLoopUtilization / setResourceTimingBufferSize / timerify ──
try {
  console.log("eventLoopUtilization typeof:", typeof perf_hooks.performance.eventLoopUtilization);
} catch (e) {
  console.log("eventLoopUtilization error:", (e as Error).message);
}

try {
  console.log("setResourceTimingBufferSize typeof:", typeof perf_hooks.performance.setResourceTimingBufferSize);
} catch (e) {
  console.log("setResourceTimingBufferSize error:", (e as Error).message);
}

try {
  console.log("timerify typeof:", typeof perf_hooks.performance.timerify);
} catch (e) {
  console.log("timerify error:", (e as Error).message);
}

try {
  console.log("markResourceTiming typeof:", typeof perf_hooks.performance.markResourceTiming);
} catch (e) {
  console.log("markResourceTiming error:", (e as Error).message);
}

// ── Class: PerformanceObserver ──
try {
  console.log("PerformanceObserver typeof:", typeof perf_hooks.PerformanceObserver);
  console.log("supportedEntryTypes typeof:", typeof perf_hooks.PerformanceObserver.supportedEntryTypes);
  const obs = new perf_hooks.PerformanceObserver(() => {});
  console.log("observer.observe typeof:", typeof obs.observe);
  console.log("observer.disconnect typeof:", typeof obs.disconnect);
  console.log("observer.takeRecords typeof:", typeof obs.takeRecords);
  obs.observe({ entryTypes: ["mark"] });
  obs.disconnect();
  console.log("observer observe+disconnect ok");
} catch (e) {
  console.log("PerformanceObserver error:", (e as Error).message);
}

// ── Module-Level Functions ──
try {
  console.log("createHistogram typeof:", typeof perf_hooks.createHistogram);
} catch (e) {
  console.log("createHistogram error:", (e as Error).message);
}

try {
  console.log("monitorEventLoopDelay typeof:", typeof perf_hooks.monitorEventLoopDelay);
} catch (e) {
  console.log("monitorEventLoopDelay error:", (e as Error).message);
}

try {
  console.log("module.eventLoopUtilization typeof:", typeof perf_hooks.eventLoopUtilization);
} catch (e) {
  console.log("module.eventLoopUtilization error:", (e as Error).message);
}

try {
  console.log("module.timerify typeof:", typeof perf_hooks.timerify);
} catch (e) {
  console.log("module.timerify error:", (e as Error).message);
}

// Coverage: 0 auto-emitted, 49 TODO, 0 skip-listed.
