mirror of
https://github.com/stablyai/orca.git
synced 2026-11-13 09:27:29 +00:00
* refactor(tooling): organize test runtime and maintenance owners * test(tooling): preserve relocated runtime fixture dependency edges * refactor(tooling): preserve xterm routing owner checks * ci(tooling): include routing owner in sparse checkout * test(tooling): preserve copied workflow dependency closures * fix(tooling): normalize hashed JSON assets in release parity * fix(tooling): distinguish asset aliases from literal references * fix(tooling): frame normalized asset reference payloads * fix(tooling): normalize decoded JSON asset references * refactor(tooling): organize build, CI and release owners * fix(tooling): align moved generator and workflow path contracts * fix(tooling): update generated plugin bundle owner banners * test(tooling): create relocated mobile verifier fixture directories * test(tooling): copy headless detector dependency closure * test(tooling): align native batch policy fixtures with owner path * fix(tooling): link moved reliability command to historical evidence * fix(tooling): preserve nested sandbox owners and canonical guide source * fix(tooling): target release version owners in checkout fixture
33 lines
1.0 KiB
JavaScript
33 lines
1.0 KiB
JavaScript
import { readFileSync } from 'node:fs'
|
|
import path from 'node:path'
|
|
import { performance } from 'node:perf_hooks'
|
|
import { runProcess } from '@orca/process-host'
|
|
|
|
export async function measurePreflightCommand({
|
|
program,
|
|
args,
|
|
label,
|
|
root,
|
|
output,
|
|
env,
|
|
timeoutMs = 240_000
|
|
}) {
|
|
const resourceFile = path.join(output, `${label}.resources.txt`)
|
|
const start = performance.now()
|
|
const result = await runProcess({
|
|
program: process.platform === 'linux' ? '/usr/bin/time' : program,
|
|
args: process.platform === 'linux' ? ['-v', '-o', resourceFile, program, ...args] : args,
|
|
cwd: root,
|
|
env: { ...env, LC_ALL: 'C' },
|
|
timeoutMs,
|
|
maxOutputBytes: 8 * 1024 * 1024
|
|
})
|
|
if (result.outputTruncated) {
|
|
throw new Error(`Benchmark output was truncated: ${label}`)
|
|
}
|
|
const resources = process.platform === 'linux' ? readFileSync(resourceFile, 'utf8') : ''
|
|
const peakRssKiB =
|
|
Number(resources.match(/Maximum resident set size \(kbytes\): (\d+)/)?.[1]) || null
|
|
return { ...result, durationMs: performance.now() - start, peakRssKiB }
|
|
}
|