The ultimate harness for coding agents and beyond. All your agents. All your machines. One command center. Start with code, then follow your curiosity and build across disciplines: CAD, circuits, robots, games and music.
TypeScript 3d-modelingagent-frameworkagent-harnessai-agentscadclaude-codecodexcoding-agentsdeveloper-toolsesp32game-developmentmcp-servermulti-agentopen-hardwareopencodeopenharnesspcbroboticsterminaltmux
Reduce idle serial CPU and wakeups with native readiness (#565)
Deeff2983eee911
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.ymlindex d53d53492..424722e2f 100644--- a/.github/workflows/ci.yml+++ b/.github/workflows/ci.yml@@ -34,6 +34,33 @@ concurrency:cancel-in-progress: falsejobs:+ # tty.ReadStream uses libuv's native TTY handle. Exercise descriptor ownership,+ # binary backpressure and unplug behavior on both supported OSes and runtimes.+ # These are disposable PTYs; no USB device or existing daemon is touched.+ serial-native:+ strategy:+ fail-fast: false+ matrix:+ os: [ubuntu-latest, macos-latest]+ node: [20.19.0, 22.23.2]+ runs-on: ${{ matrix.os }}+ timeout-minutes: 10+ defaults:+ run:+ working-directory: cli+ steps:+ - uses: actions/checkout@v7+ - uses: actions/setup-node@v7+ with:+ node-version: ${{ matrix.node }}+ cache: npm+ cache-dependency-path: cli/package-lock.json+ - run: npm ci --no-audit --no-fund+ - name: Require native PTY support instead of silently skipping it+ run: python3 -c 'import pty'+ - name: Serial lifecycle, binary transfer and descriptor cleanup+ run: npx vitest run src/cable/serial.spec.ts src/cable/serial.real.spec.ts --maxWorkers=1+# Typecheck, the full suite, and the package updater's complete-coverage gate.typecheck-test:runs-on: ubuntu-latestdiff --git a/cli/scripts/benchmark-serial-idle.mjs b/cli/scripts/benchmark-serial-idle.mjsnew file mode 100644index 000000000..4bf053656--- /dev/null+++ b/cli/scripts/benchmark-serial-idle.mjs@@ -0,0 +1,40 @@+// Worker for benchmark-serial-idle.py. Opens only the driver's disposable PTYs.+import { pathToFileURL } from 'node:url'+import { setTimeout as wait } from 'node:timers/promises'+import assert from 'node:assert/strict'++const { SerialLink } = await import(pathToFileURL(process.argv[2]).href)+const ports = JSON.parse(process.argv[3])+let bytes = 0, closed = 0+const links = []+try {+ for (const port of ports) {+ links.push(await SerialLink.open(port, chunk => { bytes += chunk.length }, () => { closed++ }))+ }+ await wait(350)+ assert.equal(bytes, 0)+ assert.equal(closed, 0)+ process.stdout.write(JSON.stringify({ ready: true, pid: process.pid, node: process.version, uv: process.versions.uv }) + '\n')+ const begin = process.hrtime.bigint(), initialResources = process.resourceUsage(), initialCpu = process.cpuUsage()+ await wait(12_000)+ const cpu = process.cpuUsage(initialCpu)+ const elapsedMs = Number(process.hrtime.bigint() - begin) / 1e6+ const resources = process.resourceUsage()+ const result = {+ pid: process.pid, ports: ports.length, elapsedMs,+ userCpuMs: cpu.user / 1000, systemCpuMs: cpu.system / 1000,+ cpuPercentOneCore: (cpu.user + cpu.system) / (elapsedMs * 10),+ voluntaryContextSwitches: resources.voluntaryContextSwitches - initialResources.voluntaryContextSwitches,+ involuntaryContextSwitches: resources.involuntaryContextSwitches - initialResources.involuntaryContextSwitches,+ receivedBytes: bytes, unexpectedlyClosed: closed, rssBytes: process.memoryUsage().rss,+ }+ assert.equal(bytes, 0)+ assert.equal(closed, 0)+ assert(links.every(link => link.isOpen))+ await Promise.all(links.map(link => link.close('benchmark complete')))+ assert.equal(closed, ports.length)+ assert(links.every(link => !link.isOpen))+ process.stdout.write(JSON.stringify(result) + '\n')+} finally {+ await Promise.all(links.map(link => link.close('benchmark cleanup')))+}diff --git a/cli/scripts/benchmark-serial-idle.py b/cli/scripts/benchmark-serial-idle.pynew file mode 100644index 000000000..bc421d39c--- /dev/null+++ b/cli/scripts/benchmark-serial-idle.py@@ -0,0 +1,103 @@+"""Matched idle serial measurements using owned PTYs, never real USB ports.++python3 cli/scripts/benchmark-serial-idle.py baseline.ts candidate.ts new-output-dir+Optionally pass --node /path/to/node and --sampler /path/to/process-usage-v2.+The output directory must not exist. All observations and source copies are kept.+"""+import argparse+import datetime+import hashlib+import json+import os+from pathlib import Path+import platform+import pty+import select+import shutil+import subprocess++parser = argparse.ArgumentParser(description=__doc__)+parser.add_argument('baseline', type=Path)+parser.add_argument('candidate', type=Path)+parser.add_argument('output', type=Path)+parser.add_argument('--node', default=shutil.which('node'))+parser.add_argument('--sampler', type=Path)+args = parser.parse_args()+assert args.node, 'Node is required'+root = args.output.resolve()+root.mkdir() # Refuse to overwrite existing evidence.+cli = Path(__file__).resolve().parents[1]+worker = Path(__file__).with_suffix('.mjs')+for variant in ('baseline', 'candidate'):+ source = root / f'{variant}.ts'+ shutil.copyfile(getattr(args, variant), source)+ subprocess.run([+ args.node, '-e',+ "require(process.argv[1]).buildSync({entryPoints:[process.argv[2]],"+ "outfile:process.argv[3],bundle:true,platform:'node',format:'esm',target:'node20'})",+ str(cli / 'node_modules/esbuild/lib/main.js'), str(source), str(root / f'{variant}.mjs'),+ ], check=True)++report = {+ 'kind': 'owned_native_pty_idle_serial',+ 'startedAt': datetime.datetime.now(datetime.timezone.utc).isoformat(),+ 'platform': platform.platform(),+ 'baselineSourceSha256': hashlib.sha256((root / 'baseline.ts').read_bytes()).hexdigest(),+ 'candidateSourceSha256': hashlib.sha256((root / 'candidate.ts').read_bytes()).hexdigest(),+ 'runs': [],+}+output = root / 'results.json'+try:+ for count in (1, 3):+ for trial in range(3):+ variants = ('baseline', 'candidate') if trial % 2 == 0 else ('candidate', 'baseline')+ for variant in variants:+ handles, paths, child = [], [], None+ try:+ for _ in range(count):+ master, slave = pty.openpty()+ handles.extend((master, slave))+ paths.append(os.ttyname(slave))+ child = subprocess.Popen(+ [args.node, str(worker), str(root / f'{variant}.mjs'), json.dumps(paths)],+ stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE,+ text=True, start_new_session=True,+ env={**os.environ, 'UV_THREADPOOL_SIZE': '1'},+ )+ readable, _, _ = select.select([child.stdout], [], [], 8)+ assert readable, 'Serial fixture did not become ready'+ ready = json.loads(child.stdout.readline())+ assert ready['ready'] and ready['pid'] == child.pid+ usage = None+ if args.sampler:+ label = f'{variant}-{count}-ports-{trial}'+ path = root / f'{label}-usage.json'+ subprocess.run([+ str(args.sampler.resolve()), str(child.pid), '10', label, str(path),+ ], check=True, capture_output=True, text=True, timeout=12)+ usage = json.loads(path.read_text())+ assert usage['schema'] == 2 and usage['success'], 'Require calibrated native sampler'+ stdout, stderr = child.communicate(timeout=15)+ assert child.returncode == 0, stderr+ result = json.loads(stdout)+ result.update(variant=variant, trial=trial, runtime=ready)+ if usage:+ result['usage'] = usage+ report['runs'].append(result)+ print(json.dumps({k: result[k] for k in (+ 'variant', 'trial', 'ports', 'cpuPercentOneCore',+ )}), flush=True)+ output.write_text(json.dumps(report, indent=2) + '\n')+ finally:+ if child is not None and child.poll() is None:+ child.terminate()+ try:+ child.wait(timeout=3)+ except subprocess.TimeoutExpired:+ child.kill()+ child.wait(timeout=3)+ for descriptor in handles:+ os.close(descriptor)+finally:+ report['endedAt'] = datetime.datetime.now(datetime.timezone.utc).isoformat()+ output.write_text(json.dumps(report, indent=2) + '\n')diff --git a/cli/src/cable/__fixtures__/serialDuplex.py b/cli/src/cable/__fixtures__/serialDuplex.pynew file mode 100644index 000000000..0c900b779--- /dev/null+++ b/cli/src/cable/__fixtures__/serialDuplex.py@@ -0,0 +1,64 @@+"""Drive an owned PTY; never enumerate or open a real device."""+import hashlib+import json+import os+import pty+import select+import subprocess+import sys+import time++node, worker, mode = sys.argv[1:]+master, slave = pty.openpty()+child = subprocess.Popen(+ [node, worker, os.ttyname(slave), mode],+ stdout=subprocess.PIPE, stderr=subprocess.PIPE, text=True,+ env={**os.environ, 'UV_THREADPOOL_SIZE': '1'}, start_new_session=True,+)++def phase(expected):+ line = child.stdout.readline()+ assert line, (child.poll(), child.stderr.read())+ value = json.loads(line)+ assert value['phase'] == expected, value+ return value++try:+ phase('ready')+ os.set_blocking(master, False)+ payload = bytes(range(256)) * 256+ offset = 0+ deadline = time.monotonic() + 5+ while offset < len(payload):+ assert time.monotonic() < deadline, 'input stalled'+ if select.select([], [master], [], 0.1)[1]:+ try:+ offset += os.write(master, payload[offset:])+ except BlockingIOError:+ pass+ phase('received')+ phase('blocked')+ if mode == 'duplex':+ expected = bytes(range(256)) * 4096 + bytes(reversed(range(256))) * 4096+ actual = bytearray()+ deadline = time.monotonic() + 5+ while len(actual) < len(expected):+ assert time.monotonic() < deadline, 'backpressured output stalled'+ if select.select([master], [], [], 0.1)[0]:+ actual.extend(os.read(master, 65536))+ assert actual == expected, 'binary bytes changed or frames interleaved'+ assert phase('sent')['sha256'] == hashlib.sha256(expected).hexdigest()+ if mode != 'close':+ os.close(master)+ master = None+ phase('passed')+ out, err = child.communicate(timeout=3)+ assert child.returncode == 0, (child.returncode, out, err)+ print(json.dumps({'mode': mode, 'passed': True, 'sessionLeader': True}))+finally:+ if child.poll() is None:+ child.terminate()+ child.wait(timeout=3)+ if master is not None:+ os.close(master)+ os.close(slave)diff --git a/cli/src/cable/__fixtures__/serialDuplex.ts b/cli/src/cable/__fixtures__/serialDuplex.tsnew file mode 100644index 000000000..bc11b6ed7--- /dev/null+++ b/cli/src/cable/__fixtures__/serialDuplex.ts@@ -0,0 +1,52 @@+// Paired with serialDuplex.py: only that driver's disposable PTY is opened.+import assert from 'node:assert/strict'+import { createHash } from 'node:crypto'+import { SerialLink } from '../serial.js'++const [path, mode] = process.argv.slice(2)+const timeout = setTimeout(() => { console.error('Serial duplex fixture timed out'); process.exit(1) }, 8_000)+const emit = (value: unknown) => process.stdout.write(JSON.stringify(value) + '\n')+const input = Buffer.from(Array.from({ length: 65536 }, (_, i) => i % 256))+const received: Buffer[] = []+let receivedBytes = 0, finishInput!: () => void, finishClose!: () => void, closeCount = 0+const gotInput = new Promise<void>(resolve => { finishInput = resolve })+const gotClose = new Promise<void>(resolve => { finishClose = resolve })+const link = await SerialLink.open(path, chunk => {+ received.push(chunk)+ receivedBytes += chunk.length+ if (receivedBytes >= input.length) finishInput()+}, () => { closeCount++; finishClose() })++try {+ emit({ phase: 'ready' })+ await gotInput+ assert.deepEqual(Buffer.concat(received), input)+ emit({ phase: 'received', bytes: receivedBytes })+ // Each frame is larger than the kernel tty buffer; the driver initially does not read.+ const first = Buffer.from(Array.from({ length: 1024 * 1024 }, (_, i) => i % 256))+ const second = Buffer.from(Array.from({ length: 1024 * 1024 }, (_, i) => 255 - i % 256))+ let settled = false+ const writing = Promise.allSettled([link.write(first), link.write(second)]).then(results => { settled = true; return results })+ await new Promise(resolve => setTimeout(resolve, 50))+ assert.equal(settled, false, 'fixture did not exercise backpressure')+ emit({ phase: 'blocked' })+ if (mode === 'close') await link.close('user closed')+ const writes = await writing+ if (mode === 'duplex') {+ assert.deepEqual(writes.map(r => r.status), ['fulfilled', 'fulfilled'])+ emit({ phase: 'sent', bytes: first.length + second.length,+ sha256: createHash('sha256').update(first).update(second).digest('hex') })+ } else {+ assert.deepEqual(writes.map(r => r.status), ['rejected', 'rejected'])+ }+ await gotClose+ assert.equal(closeCount, 1)+ assert.equal(link.isOpen, false)+ await assert.rejects(link.write(Buffer.from('late')), /closed/)+ await link.close('duplicate')+ assert.equal(closeCount, 1)+ emit({ phase: 'passed', mode })+} finally {+ await link.close()+ clearTimeout(timeout)+}diff --git a/cli/src/cable/__fixtures__/serialIdle.ts b/cli/src/cable/__fixtures__/serialIdle.tsindex 9a9a356bc..b1d03e9c4 100644--- a/cli/src/cable/__fixtures__/serialIdle.ts+++ b/cli/src/cable/__fixtures__/serialIdle.ts@@ -3,6 +3,7 @@import assert from 'node:assert/strict'import { lookup } from 'node:dns/promises'import { stat } from 'node:fs/promises'+import { closeSync, fstatSync, openSync, readdirSync } from 'node:fs'import { createServer } from 'node:http'import { SerialLink } from '../serial.js'@@ -15,18 +16,34 @@ const limit = <T>(work: Promise<T>) => Promise.race([])try {+ let descriptors: number | undefinedfor (let i = 0; i < 8; i++) {let closed = 0const link = await SerialLink.open(process.argv[2]!, () => {}, () => closed++)- await new Promise((resolve) => setTimeout(resolve, 20))- await limit(Promise.all([- lookup('localhost'),- stat(process.execPath),- fetch(`http://localhost:${address.port}`, { signal: AbortSignal.timeout(2_000) }).then((res) => res.text()),- ]))- await limit(Promise.all([link.close('silence'), link.close('silence')]))- assert.equal(closed, 1)- assert.equal(link.isOpen, false)+ // Reuse the released original descriptor for an unrelated file. Destroying the+ // TTY must not close it accidentally while closing the native duplicate.+ const sentinel = openSync(process.execPath, 'r')+ try {+ await new Promise((resolve) => setTimeout(resolve, 20))+ await limit(Promise.all([+ lookup('localhost'),+ stat(process.execPath),+ fetch(`http://localhost:${address.port}`, { signal: AbortSignal.timeout(2_000) }).then((res) => res.text()),+ ]))+ await limit(Promise.all([link.close('silence'), link.close('silence')]))+ assert.equal(closed, 1)+ assert.equal(link.isOpen, false)+ assert(fstatSync(sentinel).size > 0, 'serial close affected an unrelated descriptor')+ } finally {+ await link.close()+ closeSync(sentinel)+ }+ // Native TTY streams can own a different descriptor from the one they were given.+ // Every reopen must release both; checking after warmup ignores one-time runtime handles.+ await new Promise<void>(resolve => setImmediate(resolve))+ const count = readdirSync(process.platform === 'linux' ? '/proc/self/fd' : '/dev/fd').length+ if (descriptors === undefined) descriptors = count+ else assert.equal(count, descriptors, 'serial reopen leaked a file descriptor')}process.stdout.write('8 idle reopen cycles: DNS, HTTP, file I/O and close succeeded\n')process.exit(0)diff --git a/cli/src/cable/serial.real.spec.ts b/cli/src/cable/serial.real.spec.tsindex cff6dc16b..c7533ee7b 100644--- a/cli/src/cable/serial.real.spec.ts+++ b/cli/src/cable/serial.real.spec.ts@@ -13,7 +13,7 @@ const hasPty = process.platform !== 'win32' && spawnSync('python3', ['-c', 'impoit.skipIf(!hasPty)('keeps DNS and file I/O working across repeated silent tty closes with one worker', async () => {const scratch = await mkdtemp(join(tmpdir(), 'serial-idle-'))- // The master stays open and sends nothing. This exercises the real kernel tty and real fs reads,+ // The master stays open and sends nothing. This exercises the real kernel tty and native reads,// without touching a USB device or requiring a native production dependency.const python = spawn('python3', ['-u', '-c','import os, pty, sys\nmaster, slave = pty.openpty()\nprint(os.ttyname(slave), flush=True)\nsys.stdin.read()\n',@@ -36,3 +36,21 @@ it.skipIf(!hasPty)('keeps DNS and file I/O working across repeated silent tty clawait rm(scratch, { recursive: true, force: true })}}, 15_000)++it.skipIf(!hasPty).each(['duplex', 'disconnect', 'close'])(+ 'preserves binary serial frames and handles %s while writes are backpressured', async mode => {+ const scratch = await mkdtemp(join(tmpdir(), 'serial-duplex-'))+ try {+ const worker = join(scratch, 'serial-duplex.mjs')+ await build({+ entryPoints: [fileURLToPath(new URL('./__fixtures__/serialDuplex.ts', import.meta.url))],+ outfile: worker, bundle: true, platform: 'node', format: 'esm', target: 'node20',+ })+ const driver = fileURLToPath(new URL('./__fixtures__/serialDuplex.py', import.meta.url))+ const { stdout } = await promisify(execFile)('python3', [driver, process.execPath, worker, mode], { timeout: 12_000 })+ expect(JSON.parse(stdout)).toEqual({ mode, passed: true, sessionLeader: true })+ } finally {+ await rm(scratch, { recursive: true, force: true })+ }+ }, 15_000,+)diff --git a/cli/src/cable/serial.spec.ts b/cli/src/cable/serial.spec.tsindex 3f04b80e6..01f34569c 100644--- a/cli/src/cable/serial.spec.ts+++ b/cli/src/cable/serial.spec.ts@@ -1,75 +1,170 @@+import { EventEmitter } from 'node:events'+import { constants } from 'node:fs'import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'-const io = vi.hoisted(() => ({ open: vi.fn(), configure: vi.fn() }))-vi.mock('node:fs/promises', () => ({ open: io.open }))+const io = vi.hoisted(() => ({ open: vi.fn(), close: vi.fn(), configure: vi.fn(), stream: vi.fn() }))+vi.mock('node:fs', async (original) => ({ ...await original<typeof import('node:fs')>(), openSync: io.open, closeSync: io.close }))+vi.mock('node:tty', () => ({ ReadStream: io.stream }))vi.mock('node:child_process', () => ({ execFile: io.configure }))import { SerialLink } from './serial.js'-const again = () => Object.assign(new Error('busy'), { code: 'EAGAIN' })+function port(nativeFd = 43) {+ const stream = Object.assign(new EventEmitter(), {+ _handle: { fd: nativeFd },+ destroyed: false,+ write: vi.fn((_bytes: Uint8Array, done: (error?: Error) => void) => { queueMicrotask(() => done()); return true }),+ destroy: vi.fn(() => { queueMicrotask(() => stream.emit('close')); return stream }),+ })+ io.stream.mockImplementation(function () { return stream })+ return stream+}+const tick = async () => { for (let i = 0; i < 10; i++) await Promise.resolve() }-describe('nonblocking serial link', () => {+describe('event-driven serial link', () => {beforeEach(() => {vi.useFakeTimers()+ io.open.mockReturnValue(42)io.configure.mockImplementation((_cmd, _args, callback) => callback(null, '', ''))})- afterEach(() => { vi.useRealTimers(); vi.clearAllMocks() })-- it('preserves frame order across short writes and backpressure', async () => {- const sent: number[] = []- let calls = 0- const handle = {- read: vi.fn().mockRejectedValue(again()),- write: vi.fn(async (bytes: Uint8Array, offset: number, length: number) => {- if (++calls % 2 === 0) throw again()- const count = Math.min(2, length)- sent.push(...bytes.subarray(offset, offset + count))- return { bytesWritten: count }- }),- close: vi.fn().mockResolvedValue(undefined),- }- io.open.mockResolvedValue(handle)+ afterEach(() => { vi.useRealTimers(); vi.resetAllMocks() })++ it('stays idle without a timer, preserves raw bytes, and closes the duplicate descriptor', async () => {+ const stream = port(), received = vi.fn(), closed = vi.fn()+ const link = await SerialLink.open('/dev/fake', received, closed)+ expect(io.open).toHaveBeenCalledWith('/dev/fake', constants.O_RDWR | constants.O_NOCTTY | constants.O_NONBLOCK)+ expect(io.close).toHaveBeenCalledExactlyOnceWith(42)+ expect(io.stream).toHaveBeenCalledWith(42, { readable: true, writable: true })+ expect(vi.getTimerCount()).toBe(0)+ await vi.advanceTimersByTimeAsync(60_000)+ expect(received).not.toHaveBeenCalled()+ expect(stream.write).not.toHaveBeenCalled()+ const bytes = Buffer.from([0, 3, 13, 10, 127, 128, 255])+ stream.emit('data', bytes)+ expect(received).toHaveBeenCalledExactlyOnceWith(bytes)+ await link.close()+ expect(closed).toHaveBeenCalledExactlyOnceWith('closed')+ expect(stream.destroy).toHaveBeenCalledTimes(1)+ })++ it('does not close a descriptor adopted directly by the native stream', async () => {+ const stream = port(42)const link = await SerialLink.open('/dev/fake', vi.fn(), vi.fn())- const writes = Promise.all([link.write(Buffer.from([1, 2, 3, 4, 5])), link.write(Buffer.from([6, 7, 8]))])- await vi.advanceTimersByTimeAsync(50)+ expect(io.close).not.toHaveBeenCalled()+ await link.close()+ expect(io.close).not.toHaveBeenCalled()+ expect(stream.destroy).toHaveBeenCalledTimes(1)+ })++ it('closes the descriptor if native stream construction fails', async () => {+ io.stream.mockImplementation(function () { throw new Error('TTY unavailable') })+ await expect(SerialLink.open('/dev/fake', vi.fn(), vi.fn())).rejects.toThrow('TTY unavailable')+ expect(io.close).toHaveBeenCalledExactlyOnceWith(42)+ })++ it('releases the native stream if closing the original descriptor fails', async () => {+ const stream = port()+ io.close.mockImplementation(() => { throw new Error('close failed') })+ await expect(SerialLink.open('/dev/fake', vi.fn(), vi.fn())).rejects.toThrow('close failed')+ expect(io.close).toHaveBeenCalledTimes(1)+ expect(stream.destroy).toHaveBeenCalledTimes(1)+ })++ it('does not open a port that could not be configured raw', async () => {+ io.configure.mockImplementation((_cmd, _args, callback) => callback(new Error('stty failed')))+ await expect(SerialLink.open('/dev/fake', vi.fn(), vi.fn())).rejects.toThrow('stty failed')+ expect(io.open).not.toHaveBeenCalled()+ expect(io.stream).not.toHaveBeenCalled()+ })++ it('preserves frame order and waits for the backpressured frame to finish', async () => {+ const stream = port(), completions: Array<(error?: Error) => void> = []+ stream.write.mockImplementation((_bytes, done) => { completions.push(done); return false })+ const link = await SerialLink.open('/dev/fake', vi.fn(), vi.fn())+ const first = Buffer.from([1, 2, 3]), second = Buffer.from([4, 5])+ const writes = Promise.all([link.write(first), link.write(second)])+ await tick()+ expect(stream.write.mock.calls.map(([bytes]) => bytes)).toEqual([first])+ completions.shift()!()+ await tick()+ expect(stream.write.mock.calls.map(([bytes]) => bytes)).toEqual([first, second])+ completions.shift()!()await writes- expect(sent).toEqual([1, 2, 3, 4, 5, 6, 7, 8])await link.close()})- it('stops retrying backpressured writes when closed and rejects queued frames', async () => {- const handle = {- read: vi.fn().mockRejectedValue(again()),- write: vi.fn().mockRejectedValue(again()),- close: vi.fn().mockResolvedValue(undefined),- }- io.open.mockResolvedValue(handle)- const closed = vi.fn()- const link = await SerialLink.open('/dev/fake', vi.fn(), closed)+ it('rejects interrupted and queued frames on close without issuing another write', async () => {+ const stream = port()+ let writing!: (error?: Error) => void+ stream.write.mockImplementation((_bytes, done) => { writing = done; return false })+ stream.destroy.mockImplementation(() => {+ queueMicrotask(() => { writing(new Error('port closed')); stream.emit('close') })+ return stream+ })+ const closed = vi.fn(), link = await SerialLink.open('/dev/fake', vi.fn(), closed)const writes = Promise.allSettled([link.write(Buffer.from('first')), link.write(Buffer.from('second'))])- await vi.advanceTimersByTimeAsync(10)- await Promise.all([link.close(), link.close()])- const before = handle.write.mock.calls.length- await vi.advanceTimersByTimeAsync(50)- expect((await writes).map((result) => result.status)).toEqual(['rejected', 'rejected'])- expect(handle.write).toHaveBeenCalledTimes(before)- expect(handle.close).toHaveBeenCalledTimes(1)- expect(closed).toHaveBeenCalledTimes(1)+ await tick()+ const closing = link.close('user closed')+ expect(link.isOpen).toBe(false)+ expect(link.close('duplicate')).toBe(closing)+ await closing+ expect((await writes).map(result => result.status)).toEqual(['rejected', 'rejected'])+ expect(stream.write).toHaveBeenCalledTimes(1)+ expect(stream.destroy).toHaveBeenCalledTimes(1)+ expect(closed).toHaveBeenCalledExactlyOnceWith('user closed')+ await expect(link.write(Buffer.from('late'))).rejects.toThrow('port closed')})- it('does not deliver an old read after the link is closed', async () => {- let finish!: (result: { bytesRead: number }) => void- const handle = {- read: vi.fn((buf: Buffer) => { buf[0] = 42; return new Promise((resolve) => { finish = resolve }) }),- close: vi.fn().mockResolvedValue(undefined),- }- io.open.mockResolvedValue(handle)- const received = vi.fn()- const link = await SerialLink.open('/dev/fake', received, vi.fn())- const closing = link.close()- finish({ bytesRead: 1 })- await closing+ it.each(['end', 'close'])('handles unexpected %s once and ignores late data', async event => {+ const stream = port(), closed = vi.fn(), received = vi.fn()+ const link = await SerialLink.open('/dev/fake', received, closed)+ stream.emit(event)+ stream.emit('data', Buffer.from('late'))+ await link.close('duplicate')+ expect(closed).toHaveBeenCalledExactlyOnceWith('end of stream')+ expect(received).not.toHaveBeenCalled()+ expect(stream.destroy).toHaveBeenCalledTimes(event === 'end' ? 1 : 0)+ })++ it.each(['requested', 'native'])('rejects a cancelled write with no callback error after %s close', async mode => {+ const stream = port()+ let complete!: (error?: Error) => void+ stream.write.mockImplementation((_bytes, done) => { complete = done; return false })+ const link = await SerialLink.open('/dev/fake', vi.fn(), vi.fn())+ const writing = expect(link.write(Buffer.from('interrupted'))).rejects.toThrow('port closed')+ await tick()+ if (mode === 'requested') await link.close('user closed')+ else stream.destroyed = true // Native destruction can precede the error/close events.+ complete()+ await writing+ await link.close()+ })++ it.each(['EIO', undefined])('preserves disconnect error %s and does not deliver data after close', async code => {+ const stream = port(), closed = vi.fn(), received = vi.fn()+ const link = await SerialLink.open('/dev/fake', received, closed)+ stream.emit('error', Object.assign(new Error('unplugged'), { code }))+ stream.emit('data', Buffer.from('late'))+ await link.close()+ expect(closed).toHaveBeenCalledExactlyOnceWith(code ?? 'Error: unplugged')expect(received).not.toHaveBeenCalled()- expect(handle.read).toHaveBeenCalledTimes(1)+ })++ it('closes when a data consumer throws, preserving the original behavior', async () => {+ const stream = port(), closed = vi.fn()+ const link = await SerialLink.open('/dev/fake', () => { throw new Error('bad frame') }, closed)+ stream.emit('data', Buffer.from('broken'))+ await link.close()+ expect(closed).toHaveBeenCalledExactlyOnceWith('Error: bad frame')+ })++ it('propagates a write failure without stranding the next queued frame', async () => {+ const stream = port()+ stream.write.mockImplementationOnce((_bytes, done) => { queueMicrotask(() => done(new Error('write failed'))); return false })+ const link = await SerialLink.open('/dev/fake', vi.fn(), vi.fn())+ const writes = await Promise.allSettled([link.write(Buffer.from('first')), link.write(Buffer.from('second'))])+ expect(writes[0]).toMatchObject({ status: 'rejected', reason: new Error('write failed') })+ expect(writes[1].status).toBe('fulfilled')+ await link.close()})})diff --git a/cli/src/cable/serial.ts b/cli/src/cable/serial.tsindex be31232cc..77ff56174 100644--- a/cli/src/cable/serial.ts+++ b/cli/src/cable/serial.ts@@ -5,19 +5,12 @@// a per-platform release matrix into a distribution that is currently a download. A tty is a file, `stty`// puts it in raw mode, and that is the whole of what this needs.import { execFile } from 'node:child_process'-import { constants, existsSync, readFileSync, readdirSync } from 'node:fs'-import { open, type FileHandle } from 'node:fs/promises'+import { closeSync, constants, existsSync, openSync, readFileSync, readdirSync } from 'node:fs'+import { ReadStream } from 'node:tty'import { promisify } from 'node:util'const runFile = promisify(execFile)-const waitForPort = () => new Promise<void>((resolve) => setTimeout(resolve, 5))--function wouldBlock(error: unknown): boolean {- const code = (error as NodeJS.ErrnoException).code- return code === 'EAGAIN' || code === 'EWOULDBLOCK' || code === 'EINTR'-}-/** The SoC's own USB peripheral. The dial exposes this and nothing else — measured, see findDialPort. */export const DIAL_VENDOR_ID = 0x303aexport const DIAL_PRODUCT_ID = 0x1001@@ -184,7 +177,7 @@ function findLinux(): DialPort[] {}/**- * An open port, in raw mode, with a read loop.+ * An open port, in raw mode, driven by the kernel's readiness notifications.** The port coming and going — a flash, a crash, a nudged cable, the dial rebooting into a new image — is* the NORMAL case here, not the failure case. Everything about this class is written so that closing and@@ -193,13 +186,26 @@ function findLinux(): DialPort[] {export class SerialLink {private constructor(readonly path: string,- private handle: FileHandle,+ private readonly stream: ReadStream,private readonly onData: (chunk: Buffer) => void,private readonly onClosed: (why: string) => void,- ) {}+ ) {+ stream.on('data', (chunk: Buffer) => {+ if (this.closed) return+ try { this.onData(chunk) }+ catch (error) { void this.close((error as NodeJS.ErrnoException).code ?? String(error)) }+ })+ stream.on('error', (error: NodeJS.ErrnoException) => { void this.close(error.code ?? String(error)) })+ stream.once('end', () => { void this.close('end of stream') })+ stream.once('close', () => {+ this.streamClosed = true+ void this.close('end of stream')+ })+ }private closed = falseprivate closePromise: Promise<void> | null = null+ private streamClosed = falsestatic async open(path: string,@@ -226,48 +232,29 @@ export class SerialLink {//// Measured 2026-08-24: the daemon died at the exact second the cable came out, every time, and the// dial then greeted an empty room until it timed out and showed no agents.- // An async FileHandle read still occupies a libuv worker until the syscall returns. With a- // blocking tty, close() waits for that read forever when the dial is silent. Reopening strands- // another worker each time; after four opens even DNS lookup and unrelated file I/O stop.- // O_NONBLOCK makes idle reads/writes return EAGAIN so they can yield without holding a worker,- // and lets close finish without needing the device to send another byte.- const handle = await open(path, constants.O_RDWR | constants.O_NOCTTY | constants.O_NONBLOCK)- const link = new SerialLink(path, handle, onData, onClosed)- void link.readLoop()- return link- }-- private async readLoop(): Promise<void> {- const buf = Buffer.allocUnsafe(4096)- while (!this.closed) {- try {- const { bytesRead } = await this.handle.read(buf, 0, buf.length, null)- if (this.closed) return- if (bytesRead > 0) this.onData(Buffer.from(buf.subarray(0, bytesRead)))- // A zero-byte read on a tty means EOF, which for a USB CDC device means it went away.- else if (bytesRead === 0) return this.fail('end of stream')- } catch (err) {- const code = (err as NodeJS.ErrnoException).code- if (this.closed) return- // EAGAIN is a port with nothing to say, not a broken one.- if (wouldBlock(err)) {- await waitForPort()- continue- }- return this.fail(code ?? String(err))- }+ // FileHandle.read either occupies a worker while idle or needs EAGAIN polling. A TTY stream+ // uses libuv readiness instead, including short writes/backpressure, without a polling timer.+ // ReadStream is a net.Socket; opening O_RDWR and enabling both sides makes it full duplex.+ const fd = openSync(path, constants.O_RDWR | constants.O_NOCTTY | constants.O_NONBLOCK)+ let stream: ReadStream+ try { stream = new ReadStream(fd, { readable: true, writable: true }) }+ catch (error) { closeSync(fd); throw error }+ // On POSIX libuv normally reopens the tty and owns a duplicate. On its fallback path it owns+ // the supplied fd itself. Check the native handle exactly once so neither path leaks a+ // descriptor or closes it twice. The managed Node runtime's real-PTY tests cover ownership.+ const streamFd = (stream as ReadStream & { _handle: { fd: number } })._handle.fd+ if (streamFd !== fd) {+ try { closeSync(fd) }+ catch (error) { stream.destroy(); throw error }}- }-- private fail(why: string): void {- void this.close(why)+ return new SerialLink(path, stream, onData, onClosed)}/**- * Write every byte of ONE frame, looping over short writes. Rejects only when the port is gone.+ * Write every byte of ONE frame. libuv handles short writes without polling for capacity.** ⚠️ SERIALISED, AND NOT AS A PRECAUTION. A tty accepts a few hundred bytes at a time, so an 8 KB- * firmware slice takes several passes through the loop below and parks on an await between each. Frames+ * firmware slice takes several native writes before its callback completes. Frames* come from several places at once — the 5-second ping, the per-tick agent sync, a slice pump — and* without this queue a JSON frame lands in the MIDDLE of a firmware slice. The dial's decoder resyncs* past the wreckage, which costs it both frames, and the transfer then fails at the far end with a@@ -289,18 +276,15 @@ export class SerialLink {private async writeFrame(bytes: Uint8Array): Promise<void> {if (this.closed) throw new Error('port closed')- let off = 0- while (off < bytes.length) {- if (this.closed) throw new Error('port closed')- try {- const { bytesWritten } = await this.handle.write(bytes, off, bytes.length - off)- if (bytesWritten <= 0) throw new Error('short write')- off += bytesWritten- } catch (err) {- if (this.closed || !wouldBlock(err)) throw err- await waitForPort()- }- }+ await new Promise<void>((resolve, reject) => {+ this.stream.write(bytes, (error) => {+ if (error) reject(error)+ // Node 20 can invoke a cancelled native write's callback without an error+ // after destroying its stream. Do not acknowledge that interrupted frame.+ else if (this.closed || this.stream.destroyed) reject(new Error('port closed'))+ else resolve()+ })+ })}get isOpen(): boolean {@@ -310,7 +294,13 @@ export class SerialLink {close(why = 'closed'): Promise<void> {if (this.closePromise) return this.closePromisethis.closed = true- this.closePromise = this.handle.close().catch(() => {}).then(() => this.onClosed(why))+ let finish!: () => void+ this.closePromise = new Promise<void>((resolve) => { finish = resolve }).then(() => this.onClosed(why))+ if (this.streamClosed) finish()+ else {+ this.stream.once('close', finish)+ this.stream.destroy()+ }return this.closePromise}}diff --git a/docs/performance/2026-10-01-event-driven-serial.json b/docs/performance/2026-10-01-event-driven-serial.jsonnew file mode 100644index 000000000..a9ff7326e--- /dev/null+++ b/docs/performance/2026-10-01-event-driven-serial.json@@ -0,0 +1,2206 @@+{+ "kind": "owned_native_pty_idle_serial",+ "startedAt": "2026-10-02T00:37:23.696146+00:00",+ "platform": "macOS-26.6.2-arm64-arm-64bit-Mach-O",+ "baselineSourceSha256": "98ad5d54a9174fd4c6bf0817236c4f1f06a723e85f4cf267b5248a7901efacec",+ "candidateSourceSha256": "7249bb7009f5f20ab659be025befe2c2992038cbd7d5c82b8e8f3313ee45a360",+ "runs": [+ {+ "pid": 61067,+ "ports": 1,+ "elapsedMs": 12000.095375,+ "userCpuMs": 156.445,+ "systemCpuMs": 37.923,+ "cpuPercentOneCore": 1.6197204599300943,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 8920,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 54034432,+ "variant": "baseline",+ "trial": 0,+ "runtime": {+ "ready": true,+ "pid": 61067,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "baseline-1-ports-0",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 61067,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0023249999940162525,+ "interruptWakeups": 145,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14845872,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 46252032,+ "systemMachTicks": 168607,+ "userMachTicks": 810377+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0050302916642977,+ "interruptWakeups": 512,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15452176,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 46792704,+ "systemMachTicks": 238119,+ "userMachTicks": 1095425+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.003396874992177,+ "interruptWakeups": 872,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15468560,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 46809088,+ "systemMachTicks": 307178,+ "userMachTicks": 1358969+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0046322916605277,+ "interruptWakeups": 1242,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15812624,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 51183616,+ "systemMachTicks": 387169,+ "userMachTicks": 1678462+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.003533541661454,+ "interruptWakeups": 1604,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15845392,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 51216384,+ "systemMachTicks": 457103,+ "userMachTicks": 1963747+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.005028416664572,+ "interruptWakeups": 1979,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15845392,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 51216384,+ "systemMachTicks": 538144,+ "userMachTicks": 2263355+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.000544833324966,+ "interruptWakeups": 2347,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15845392,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 51216384,+ "systemMachTicks": 604536,+ "userMachTicks": 2528999+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.001881041665911,+ "interruptWakeups": 2717,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15861776,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 51232768,+ "systemMachTicks": 680308,+ "userMachTicks": 2806255+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.000347833323758,+ "interruptWakeups": 3084,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15157168,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 50839552,+ "systemMachTicks": 753947,+ "userMachTicks": 3194450+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.000224874995183,+ "interruptWakeups": 3453,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16893992,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 52887552,+ "systemMachTicks": 854584,+ "userMachTicks": 3812351+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.005052374996012,+ "interruptWakeups": 3826,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 18090216,+ "processStartMachTicks": 3075687407347,+ "residentBytes": 53952512,+ "systemMachTicks": 935807,+ "userMachTicks": 4038182+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:37:24Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 1.6641315455889194,+ "cpuSeconds": 0.16645854166666665,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.002727375001996,+ "interruptWakeupsPerSecond": 367.999632700103,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 17.252174377441406,+ "physicalFootprintMiBMedian": 15.111343383789062,+ "physicalFootprintMiBPeak": 17.252174377441406,+ "physicalFootprintMiBStart": 14.158126831054688+ }+ }+ },+ {+ "pid": 63471,+ "ports": 1,+ "elapsedMs": 12001.778333,+ "userCpuMs": 9.766,+ "systemCpuMs": 1.209,+ "cpuPercentOneCore": 0.09144478172724804,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 122,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 45318144,+ "variant": "candidate",+ "trial": 0,+ "runtime": {+ "ready": true,+ "pid": 63471,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "candidate-1-ports-0",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 63471,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0032928750006249174,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.002269750009873,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0023693750117673,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0019091666763416,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.000199250003789,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.001731458338327,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.004909625000437,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.001981416673516,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14436272,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45793280,+ "systemMachTicks": 176776,+ "userMachTicks": 743634+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.005024583340855,+ "interruptWakeups": 18,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14452608,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 46071808,+ "systemMachTicks": 192733,+ "userMachTicks": 862801+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.003332000007504,+ "interruptWakeups": 28,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13781008,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45301760,+ "systemMachTicks": 205285,+ "userMachTicks": 975736+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.005036125003244,+ "interruptWakeups": 28,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13781008,+ "processStartMachTicks": 3075984816213,+ "residentBytes": 45301760,+ "systemMachTicks": 205285,+ "userMachTicks": 975736+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:37:36Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 0.10856899037739068,+ "cpuSeconds": 0.010858791666666666,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.001743250002619,+ "interruptWakeupsPerSecond": 1.8996688402289297,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 13.142593383789062,+ "physicalFootprintMiBMedian": 13.767501831054688,+ "physicalFootprintMiBPeak": 13.7830810546875,+ "physicalFootprintMiBStart": 13.767501831054688+ }+ }+ },+ {+ "pid": 71069,+ "ports": 1,+ "elapsedMs": 12001.421333,+ "userCpuMs": 11.033,+ "systemCpuMs": 1.272,+ "cpuPercentOneCore": 0.10252952261716916,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 98,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 45154304,+ "variant": "candidate",+ "trial": 1,+ "runtime": {+ "ready": true,+ "pid": 71069,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "candidate-1-ports-1",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 71069,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0021268333366606385,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.004230666658259,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0050357500003884,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.000600041661528,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.004517124994891,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.004205874996842,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.005023208330385,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.00502166665683,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14600112,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45957120,+ "systemMachTicks": 176017,+ "userMachTicks": 701007+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.000496499997098,+ "interruptWakeups": 18,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14583656,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 46219264,+ "systemMachTicks": 196356,+ "userMachTicks": 841772+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.00502679166675,+ "interruptWakeups": 28,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13584352,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45137920,+ "systemMachTicks": 206226,+ "userMachTicks": 964017+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.00379341666121,+ "interruptWakeups": 28,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13584352,+ "processStartMachTicks": 3076282370925,+ "residentBytes": 45137920,+ "systemMachTicks": 206226,+ "userMachTicks": 964017+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:37:48Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 0.12215422531384021,+ "cpuSeconds": 0.012217458333333334,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.00166658332455,+ "interruptWakeupsPerSecond": 1.8996834019320417,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 12.955047607421875,+ "physicalFootprintMiBMedian": 13.923751831054688,+ "physicalFootprintMiBPeak": 13.923751831054688,+ "physicalFootprintMiBStart": 13.923751831054688+ }+ }+ },+ {+ "pid": 74532,+ "ports": 1,+ "elapsedMs": 12000.298833,+ "userCpuMs": 174.818,+ "systemCpuMs": 39.048,+ "cpuPercentOneCore": 1.7821722856757793,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 9113,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 54231040,+ "variant": "baseline",+ "trial": 1,+ "runtime": {+ "ready": true,+ "pid": 74532,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "baseline-1-ports-1",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 74532,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0022572499874513596,+ "interruptWakeups": 141,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14993328,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 46399488,+ "systemMachTicks": 174831,+ "userMachTicks": 854490+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0050218749966007,+ "interruptWakeups": 508,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15632400,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 46972928,+ "systemMachTicks": 253266,+ "userMachTicks": 1180003+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0050152499898104,+ "interruptWakeups": 874,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15648784,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 46989312,+ "systemMachTicks": 324019,+ "userMachTicks": 1481852+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0014371249999385,+ "interruptWakeups": 1251,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15943696,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 51085312,+ "systemMachTicks": 417538,+ "userMachTicks": 1908566+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.005027874998632,+ "interruptWakeups": 1625,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16009232,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 51380224,+ "systemMachTicks": 501213,+ "userMachTicks": 2288961+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.001185208326206,+ "interruptWakeups": 1998,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16042000,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 51412992,+ "systemMachTicks": 570065,+ "userMachTicks": 2572128+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.003107333322987,+ "interruptWakeups": 2381,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16042000,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 51412992,+ "systemMachTicks": 650461,+ "userMachTicks": 2913538+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.002424166654237,+ "interruptWakeups": 2738,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16042000,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 51412992,+ "systemMachTicks": 711652,+ "userMachTicks": 3174256+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.004138874995988,+ "interruptWakeups": 3109,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15173552,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 50839552,+ "systemMachTicks": 789561,+ "userMachTicks": 3547277+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.00088941665308,+ "interruptWakeups": 3483,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 17156112,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 53166080,+ "systemMachTicks": 878648,+ "userMachTicks": 4109845+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.005018541662139,+ "interruptWakeups": 3859,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 18303184,+ "processStartMachTicks": 3076579880526,+ "residentBytes": 54181888,+ "systemMachTicks": 961647,+ "userMachTicks": 4417574+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:38:01Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 1.8119579988796146,+ "cpuSeconds": 0.18124583333333336,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.002761291674688,+ "interruptWakeupsPerSecond": 371.69736351646185,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 17.455276489257812,+ "physicalFootprintMiBMedian": 15.267593383789062,+ "physicalFootprintMiBPeak": 17.455276489257812,+ "physicalFootprintMiBStart": 14.298751831054688+ }+ }+ },+ {+ "pid": 79583,+ "ports": 1,+ "elapsedMs": 11999.637791,+ "userCpuMs": 147.557,+ "systemCpuMs": 37.352,+ "cpuPercentOneCore": 1.5409548456428073,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 9384,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 54034432,+ "variant": "baseline",+ "trial": 2,+ "runtime": {+ "ready": true,+ "pid": 79583,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "baseline-1-ports-2",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 79583,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0020490000024437904,+ "interruptWakeups": 145,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14993328,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 46399488,+ "systemMachTicks": 174655,+ "userMachTicks": 806498+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.00288358333637,+ "interruptWakeups": 512,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15550480,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 46874624,+ "systemMachTicks": 255058,+ "userMachTicks": 1141597+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0000355833326466,+ "interruptWakeups": 889,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15599632,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 46940160,+ "systemMachTicks": 336466,+ "userMachTicks": 1464946+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0050178749952465,+ "interruptWakeups": 1256,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15861776,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 51232768,+ "systemMachTicks": 410498,+ "userMachTicks": 1773565+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.0050239999982296,+ "interruptWakeups": 1617,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15894544,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 51265536,+ "systemMachTicks": 473983,+ "userMachTicks": 2042914+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.004203083328321,+ "interruptWakeups": 1983,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15910928,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 51281920,+ "systemMachTicks": 536969,+ "userMachTicks": 2265787+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.005015625007218,+ "interruptWakeups": 2342,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15910928,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 51281920,+ "systemMachTicks": 593876,+ "userMachTicks": 2485817+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.0050242916622665,+ "interruptWakeups": 2702,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15910928,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 51281920,+ "systemMachTicks": 651789,+ "userMachTicks": 2702192+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.002454583329381,+ "interruptWakeups": 3072,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15173552,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 50839552,+ "systemMachTicks": 717286,+ "userMachTicks": 3042952+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.004118333337829,+ "interruptWakeups": 3511,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16975888,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 52985856,+ "systemMachTicks": 888646,+ "userMachTicks": 3664764+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.001721208333038,+ "interruptWakeups": 3878,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 18106576,+ "processStartMachTicks": 3076877332324,+ "residentBytes": 53985280,+ "systemMachTicks": 953914,+ "userMachTicks": 3917269+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:38:13Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 1.6208989650511028,+ "cpuSeconds": 0.16208458333333334,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.999672208330594,+ "interruptWakeupsPerSecond": 373.3122368641331,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 17.267776489257812,+ "physicalFootprintMiBMedian": 15.158218383789062,+ "physicalFootprintMiBPeak": 17.267776489257812,+ "physicalFootprintMiBStart": 14.298751831054688+ }+ }+ },+ {+ "pid": 82678,+ "ports": 1,+ "elapsedMs": 12000.883375,+ "userCpuMs": 9.743,+ "systemCpuMs": 0.98,+ "cpuPercentOneCore": 0.08935175574106435,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 107,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 45301760,+ "variant": "candidate",+ "trial": 2,+ "runtime": {+ "ready": true,+ "pid": 82678,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "candidate-1-ports-2",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 82678,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0023639166756765917,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0050237500108778,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.004266291667591,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0050191250047646,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.004137875002925,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.002692666676012,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.005033000008552,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.004571041674353,+ "interruptWakeups": 9,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14501784,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45875200,+ "systemMachTicks": 169713,+ "userMachTicks": 660218+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.005024791680626,+ "interruptWakeups": 18,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14468968,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 46104576,+ "systemMachTicks": 182145,+ "userMachTicks": 778347+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.004647791676689,+ "interruptWakeups": 28,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13748216,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45285376,+ "systemMachTicks": 193075,+ "userMachTicks": 892193+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.000303000007989,+ "interruptWakeups": 28,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13748216,+ "processStartMachTicks": 3077174717042,+ "residentBytes": 45285376,+ "systemMachTicks": 193075,+ "userMachTicks": 892193+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:38:26Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 0.10641234736469983,+ "cpuSeconds": 0.010639041666666666,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.997939083332312,+ "interruptWakeupsPerSecond": 1.9003916548836683,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 13.111320495605469,+ "physicalFootprintMiBMedian": 13.829978942871094,+ "physicalFootprintMiBPeak": 13.829978942871094,+ "physicalFootprintMiBStart": 13.829978942871094+ }+ }+ },+ {+ "pid": 88762,+ "ports": 3,+ "elapsedMs": 11999.873791,+ "userCpuMs": 206.225,+ "systemCpuMs": 47.084,+ "cpuPercentOneCore": 2.110930534869323,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 9279,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 57835520,+ "variant": "baseline",+ "trial": 0,+ "runtime": {+ "ready": true,+ "pid": 88762,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "baseline-3-ports-0",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 88762,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0019248750031692907,+ "interruptWakeups": 163,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15648784,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 46989312,+ "systemMachTicks": 238421,+ "userMachTicks": 935087+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0034937500022352,+ "interruptWakeups": 552,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16042000,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 51412992,+ "systemMachTicks": 354294,+ "userMachTicks": 1427234+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0050258333358215,+ "interruptWakeups": 978,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16058384,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 51429376,+ "systemMachTicks": 473490,+ "userMachTicks": 1899533+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0038376250013243,+ "interruptWakeups": 1355,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16861200,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 52510720,+ "systemMachTicks": 562598,+ "userMachTicks": 2342345+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.0008349166600965,+ "interruptWakeups": 1734,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16877584,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 52527104,+ "systemMachTicks": 648109,+ "userMachTicks": 2733355+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.000914708332857,+ "interruptWakeups": 2131,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 18630720,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 54411264,+ "systemMachTicks": 736657,+ "userMachTicks": 3217509+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.002869166666642,+ "interruptWakeups": 2523,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20301912,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 56262656,+ "systemMachTicks": 840540,+ "userMachTicks": 4159034+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.000064333333285,+ "interruptWakeups": 2895,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20351064,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 56311808,+ "systemMachTicks": 921203,+ "userMachTicks": 4492102+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.00503020832548,+ "interruptWakeups": 3306,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20367448,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 56328192,+ "systemMachTicks": 1024016,+ "userMachTicks": 4817783+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.003981749992818,+ "interruptWakeups": 3676,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20383832,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 56344576,+ "systemMachTicks": 1101899,+ "userMachTicks": 5063333+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.002051916657365,+ "interruptWakeups": 4051,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20400216,+ "processStartMachTicks": 3077472201237,+ "residentBytes": 56360960,+ "systemMachTicks": 1191840,+ "userMachTicks": 5329224+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:38:38Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 2.228120026927937,+ "cpuSeconds": 0.22281483333333335,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.000127041654196,+ "interruptWakeupsPerSecond": 388.7950606832348,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 19.455162048339844,+ "physicalFootprintMiBMedian": 17.76763916015625,+ "physicalFootprintMiBPeak": 19.455162048339844,+ "physicalFootprintMiBStart": 14.923843383789062+ }+ }+ },+ {+ "pid": 93549,+ "ports": 3,+ "elapsedMs": 11999.733625,+ "userCpuMs": 11.777,+ "systemCpuMs": 1.14,+ "cpuPercentOneCore": 0.10764405614045452,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 119,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 45318144,+ "variant": "candidate",+ "trial": 0,+ "runtime": {+ "ready": true,+ "pid": 93549,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "candidate-3-ports-0",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 93549,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0020351666607894003,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0007860833284212,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0050305416662013,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.000059208337916,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.003780166662182,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.005028416664572,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.005023499994422,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.005016791663365,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14829488,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46186496,+ "systemMachTicks": 249543,+ "userMachTicks": 722872+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.000329583330313,+ "interruptWakeups": 22,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14452560,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 46104576,+ "systemMachTicks": 261193,+ "userMachTicks": 860707+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.005033333334723,+ "interruptWakeups": 32,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13731808,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 45285376,+ "systemMachTicks": 276573,+ "userMachTicks": 1002712+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.000233541664784,+ "interruptWakeups": 32,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13731808,+ "processStartMachTicks": 3077769890630,+ "residentBytes": 45285376,+ "systemMachTicks": 276573,+ "userMachTicks": 1002712+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:38:50Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 0.12788554017858136,+ "cpuSeconds": 0.01278625,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.998198375003994,+ "interruptWakeupsPerSecond": 1.9003423704315539,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 13.095672607421875,+ "physicalFootprintMiBMedian": 14.142501831054688,+ "physicalFootprintMiBPeak": 14.142501831054688,+ "physicalFootprintMiBStart": 14.142501831054688+ }+ }+ },+ {+ "pid": 98704,+ "ports": 3,+ "elapsedMs": 12000.965375,+ "userCpuMs": 10.541,+ "systemCpuMs": 1.329,+ "cpuPercentOneCore": 0.09890870966703377,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 142,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 45580288,+ "variant": "candidate",+ "trial": 1,+ "runtime": {+ "ready": true,+ "pid": 98704,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "candidate-3-ports-1",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 98704,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0021362916741054505,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0033672083372949,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0015165416698437,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0050309166690568,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.004531750004389,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.004982250000467,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.005027541672462,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.002643583342433,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14911408,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46268416,+ "systemMachTicks": 235370,+ "userMachTicks": 760306+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.00499916667468,+ "interruptWakeups": 22,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14780288,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 46399488,+ "systemMachTicks": 252838,+ "userMachTicks": 895871+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.00504783334327,+ "interruptWakeups": 32,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13977544,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 45547520,+ "systemMachTicks": 267113,+ "userMachTicks": 1011483+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.005028041676269,+ "interruptWakeups": 32,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13977544,+ "processStartMachTicks": 3078067553313,+ "residentBytes": 45547520,+ "systemMachTicks": 267113,+ "userMachTicks": 1011483+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:39:03Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 0.11784925427520282,+ "cpuSeconds": 0.011788333333333335,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.002891750002163,+ "interruptWakeupsPerSecond": 1.899450726335801,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 13.330024719238281,+ "physicalFootprintMiBMedian": 14.220626831054688,+ "physicalFootprintMiBPeak": 14.220626831054688,+ "physicalFootprintMiBStart": 14.220626831054688+ }+ }+ },+ {+ "pid": 2896,+ "ports": 3,+ "elapsedMs": 12000.536208,+ "userCpuMs": 200.959,+ "systemCpuMs": 46.045,+ "cpuPercentOneCore": 2.058274694720208,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 9105,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 56508416,+ "variant": "baseline",+ "trial": 1,+ "runtime": {+ "ready": true,+ "pid": 2896,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "baseline-3-ports-1",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 2896,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0018503333412809297,+ "interruptWakeups": 169,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 15730656,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 47104000,+ "systemMachTicks": 206364,+ "userMachTicks": 838741+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0006616666651098,+ "interruptWakeups": 584,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16107488,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 51511296,+ "systemMachTicks": 306405,+ "userMachTicks": 1248257+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.005026500002714,+ "interruptWakeups": 997,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16140256,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 51544064,+ "systemMachTicks": 400700,+ "userMachTicks": 1671891+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.002234708343167,+ "interruptWakeups": 1382,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16975840,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 52658176,+ "systemMachTicks": 503766,+ "userMachTicks": 2162066+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.000034708340536,+ "interruptWakeups": 1756,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16992224,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 52674560,+ "systemMachTicks": 586731,+ "userMachTicks": 2551856+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.004335250006989,+ "interruptWakeups": 2124,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 18892768,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 54738944,+ "systemMachTicks": 673147,+ "userMachTicks": 3059116+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.00071375000698,+ "interruptWakeups": 2500,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19908624,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 55853056,+ "systemMachTicks": 769530,+ "userMachTicks": 3763274+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.000290541676804,+ "interruptWakeups": 2864,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19941392,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 55934976,+ "systemMachTicks": 850718,+ "userMachTicks": 4148738+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.004531833343208,+ "interruptWakeups": 3243,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19957776,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 55951360,+ "systemMachTicks": 934638,+ "userMachTicks": 4424360+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.002567416668171,+ "interruptWakeups": 3615,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19974160,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 55967744,+ "systemMachTicks": 1017566,+ "userMachTicks": 4681179+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.001220250007464,+ "interruptWakeups": 3983,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19974160,+ "processStartMachTicks": 3078365265846,+ "residentBytes": 55967744,+ "systemMachTicks": 1096516,+ "userMachTicks": 4937915+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:39:15Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 2.0790168287187836,+ "cpuSeconds": 0.20788858333333335,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.999369916666183,+ "interruptWakeupsPerSecond": 381.4240328926243,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 19.048843383789062,+ "physicalFootprintMiBMedian": 18.017547607421875,+ "physicalFootprintMiBPeak": 19.048843383789062,+ "physicalFootprintMiBStart": 15.001922607421875+ }+ }+ },+ {+ "pid": 6260,+ "ports": 3,+ "elapsedMs": 12000.211083,+ "userCpuMs": 259.022,+ "systemCpuMs": 59.31,+ "cpuPercentOneCore": 2.6527200046586046,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 9966,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 57032704,+ "variant": "baseline",+ "trial": 2,+ "runtime": {+ "ready": true,+ "pid": 6260,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "baseline-3-ports-2",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 6260,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0023843333328841254,+ "interruptWakeups": 157,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16058408,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 47382528,+ "systemMachTicks": 358889,+ "userMachTicks": 1164438+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.0042170833330601,+ "interruptWakeups": 552,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16369704,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 51724288,+ "systemMachTicks": 487394,+ "userMachTicks": 1766049+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.004660958322347,+ "interruptWakeups": 933,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 16418856,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 51773440,+ "systemMachTicks": 595222,+ "userMachTicks": 2316138+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.0003454583347775,+ "interruptWakeups": 1335,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 17205288,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 52838400,+ "systemMachTicks": 721956,+ "userMachTicks": 2947771+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.005025249993196,+ "interruptWakeups": 1718,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 17238056,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 52871168,+ "systemMachTicks": 846192,+ "userMachTicks": 3525809+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.003904375000275,+ "interruptWakeups": 2111,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19040344,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 54804480,+ "systemMachTicks": 967282,+ "userMachTicks": 4187022+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.002600166655611,+ "interruptWakeups": 2506,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19941464,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 55820288,+ "systemMachTicks": 1085177,+ "userMachTicks": 4988130+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.000568874995224,+ "interruptWakeups": 2887,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 19990616,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 55918592,+ "systemMachTicks": 1189135,+ "userMachTicks": 5430748+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.00244312499126,+ "interruptWakeups": 3290,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20007000,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 55934976,+ "systemMachTicks": 1299635,+ "userMachTicks": 5799478+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.003769916656893,+ "interruptWakeups": 3700,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20007000,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 55934976,+ "systemMachTicks": 1425170,+ "userMachTicks": 6221476+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.001243583334144,+ "interruptWakeups": 4114,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 20023384,+ "processStartMachTicks": 3078662846075,+ "residentBytes": 55951360,+ "systemMachTicks": 1556187,+ "userMachTicks": 6639914+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:39:28Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 2.780639701473595,+ "cpuSeconds": 0.27803225,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.99885925000126,+ "interruptWakeupsPerSecond": 395.7451446273235,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 19.095787048339844,+ "physicalFootprintMiBMedian": 18.158287048339844,+ "physicalFootprintMiBPeak": 19.095787048339844,+ "physicalFootprintMiBStart": 15.314491271972656+ }+ }+ },+ {+ "pid": 10374,+ "ports": 3,+ "elapsedMs": 12001.261666,+ "userCpuMs": 12.498,+ "systemCpuMs": 1.889,+ "cpuPercentOneCore": 0.119879062721871,+ "voluntaryContextSwitches": 0,+ "involuntaryContextSwitches": 171,+ "receivedBytes": 0,+ "unexpectedlyClosed": 0,+ "rssBytes": 45580288,+ "variant": "candidate",+ "trial": 2,+ "runtime": {+ "ready": true,+ "pid": 10374,+ "node": "v22.23.2",+ "uv": "1.51.0"+ },+ "usage": {+ "boundary": "proc_pid_rusage for this process only; CPU 100% = one core; excludes other processes and GPU energy",+ "cpuClock": {+ "timebaseDenom": 3,+ "timebaseNumer": 125,+ "unit": "mach_absolute_time"+ },+ "label": "candidate-3-ports-2",+ "os": "Version 26.6.2 (Build 25G83)",+ "pid": 10374,+ "sampleIntervalSeconds": 1,+ "samples": [+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 0.0018689583375817165,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 1.000963625003351,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 2.0004016250022687,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 3.000983208330581,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 4.003313208333566,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 5.002477958332747,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 6.005021375007345,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 7.004000500004622,+ "interruptWakeups": 13,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14878568,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46284800,+ "systemMachTicks": 257777,+ "userMachTicks": 761096+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 8.00503554167517,+ "interruptWakeups": 22,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 14763856,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 46415872,+ "systemMachTicks": 282826,+ "userMachTicks": 905004+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 9.003608083337895,+ "interruptWakeups": 32,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13977520,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 45563904,+ "systemMachTicks": 302840,+ "userMachTicks": 1059165+ },+ {+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.00373500000569,+ "interruptWakeups": 32,+ "packageIdleWakeups": 0,+ "physicalFootprintBytes": 13977520,+ "processStartMachTicks": 3078961152357,+ "residentBytes": 45563904,+ "systemMachTicks": 302840,+ "userMachTicks": 1059165+ }+ ],+ "schema": 2,+ "startedAt": "2026-10-02T00:39:40Z",+ "success": true,+ "summary": {+ "cpuPercentOneCore": 0.1429449925354348,+ "cpuSeconds": 0.014297166666666666,+ "diskReadBytes": 0,+ "diskWriteBytes": 0,+ "elapsedSeconds": 10.001866041668109,+ "interruptWakeupsPerSecond": 1.8996455182308345,+ "packageIdleWakeupsPerSecond": 0,+ "physicalFootprintMiBEnd": 13.330001831054688,+ "physicalFootprintMiBMedian": 14.189308166503906,+ "physicalFootprintMiBPeak": 14.189308166503906,+ "physicalFootprintMiBStart": 14.189308166503906+ }+ }+ }+ ],+ "endedAt": "2026-10-02T00:39:52.513228+00:00"+}diff --git a/docs/performance/2026-10-01-event-driven-serial.md b/docs/performance/2026-10-01-event-driven-serial.mdnew file mode 100644index 000000000..73f380640--- /dev/null+++ b/docs/performance/2026-10-01-event-driven-serial.md@@ -0,0 +1,103 @@+# Idle serial transport: wait for kernel readiness++An open, silent serial port retried `FileHandle.read` every 5 ms after `EAGAIN`.+This avoided occupying a libuv worker indefinitely, but kept waking the daemon+even when a dial had no data. The replacement uses Node's full-duplex TTY stream+and libuv readiness notifications. Frame ordering, raw binary data, nonblocking+close and `O_NOCTTY` are preserved; no native dependency is added.++## Matched measurements++macOS 26.6.2 arm64, managed Node 22.23.2/libuv 1.51.0. Each observation opens+one or three **owned, silent PTYs**, warms for 350 ms, and records 12 seconds of+Node CPU time. Three observations per variant and port count alternate order.+Initialization and teardown are outside the interval. The measured candidate+precedes the write-callback cancellation guard; that guard is inactive during+this idle workload. The raw record preserves the exact measured source hash. A calibrated native+sampler records CPU, footprint and interrupt wakeups over 10 seconds inside it.++| Open ports | Node CPU before → after, % of one core | CPU reduction | Interrupt wakeups/sec before → after |+|---|---:|---:|---:|+| 1 | 1.6197 → 0.0914 | 94.35% | 371.70 → 1.90 |+| 3 | 2.1109 → 0.1076 | 94.90% | 388.80 → 1.90 |++Values are medians. Interrupt wakeups fell 99.49–99.51%. All 12 observations are+retained in [the raw record](2026-10-01-event-driven-serial.json), including+source hashes, runtime versions and every native sample. Native CPU numbers+differ slightly because their interval is shorter. Node context-switch counters+are not used as wakeup counters. Neither variant wrote disk data while idle.++These results concern an open serial transport, **not whole-app CPU, battery+life or the macOS energy warning**. Machines with no open serial ports do not+incur this polling cost. No real USB device, installed app or user daemon was+opened, stopped or restarted for these measurements.++## Correctness and compatibility++- Raw 64 KiB input with all byte values; two concurrent 1 MiB output frames,+ deliberately backpressured, checked byte-for-byte and by SHA-256.+- Unplug/EOF and explicit close during blocked writes: active and queued writes+ reject, the close callback runs once, and later writes fail.+- The native worker is a detached session leader. Unplug must not terminate it+ with `SIGHUP`; retaining `O_NOCTTY` is essential.+- Eight idle open/close cycles with one libuv worker: DNS, HTTP and file I/O+ remain available, descriptors do not accumulate, an unrelated file descriptor+ survives serial close, and close needs no input.+- Unit checks cover direct versus duplicated native descriptor ownership,+ constructor/configuration failure, frame ordering and callback failures.+- All 421 cable tests passed on managed Node 22.23.2/macOS, plus TypeScript+ checking. All 40 guard fuzz tests also passed on Linux after the correction.+ The transport class has 62/62 statements and 16/16 functions covered;+ macOS covers 24/25 branch arms, with the remaining arm+ selecting Linux's `stty -F`. The unchanged discovery code is not fully covered.+ All 19 serial unit/native tests passed on each of the four compatibility rows:+ Node 20.19.0 and 22.23.2 on macOS and Linux. Physical USB hardware is not covered+ by the PTY tests.++The broad local CLI run passed 8,276 tests and skipped 45, but failed 15 checks in+three unchanged suites: hook subprocess deadlines, installer subprocess deadlines+and installed OpenCode flags. A clean-main run reproduced hook deadlines and all+five OpenCode failures; its installer checks passed. An isolated candidate run+passed all 100 hook/installer checks and retained the five installed-OpenCode+failures. These results are retained as failures, not reported as a completely+green local suite.++On the corrected commit, the full Linux CLI job passed 8,287 tests (50 skipped),+all 40 guard fuzz tests, TypeScript checking, the launcher upgrade check and+844 updater tests (9 skipped, the existing updater coverage gate remains 100%).+The four native serial compatibility jobs also passed. The first full CI run+passed both Linux TUI end-to-end jobs; the corrected run hit the unchanged ARM+native-terminal `respawn death` timing check, then passed its isolated job rerun.+All jobs finished green in [CI run 36949101625, attempt 2](https://github.com/autonomous-ai/openharness/actions/runs/36949101625).+The failed first attempts remain available for inspection. Only this validation+note changed after the tested production commit `ac6cb26ed2e8294a10006fb3786ce7b1158fd633`.++The first native compatibility run caught a Node 20 cancellation difference on+both operating systems: its write callback can omit an error after stream+destruction. The production callback now rejects when the link or stream is+closed, so an interrupted frame cannot be acknowledged as complete. This is+covered by the existing native unplug/backpressure cases and two focused unit+cases. [Node 20 source](https://github.com/nodejs/node/blob/v20.19.0/lib/internal/stream_base_commons.js#L75-L94).++The implementation reads the internal native handle's `fd` once at construction.+On POSIX, libuv normally reopens the TTY and owns that duplicate; its fallback+adopts the supplied descriptor. The ownership check avoids both a leak and a+double-close. The native compatibility job must remain part of runtime upgrades.++## Reproduction++From the repository root with CLI dependencies installed:++```sh+git show 24128bec34cf24d83f18b6d93f1e20801eac5ca0:cli/src/cable/serial.ts > /tmp/serial-before.ts+python3 cli/scripts/benchmark-serial-idle.py \+ /tmp/serial-before.ts cli/src/cable/serial.ts /tmp/serial-new-run \+ --node /path/to/managed/node+```++Use a new output directory for each run. Add `--sampler /path/to/process-usage-v2`+on macOS to collect native counters using the calibrated sampler built from+`desktop/tool/native_benchmark/process_usage.swift`. The benchmark bundles both+sources with the same esbuild settings, preserves them and every observation,+and closes only the PTYs/processes that it created. The checked-in raw record+was collected with the equivalent driver before it was added to the repository.