===== turns.ps1 param([string]$id, [int]$n = 6) Set-Location C:\p\repos\p0 New-Item -ItemType Directory -Force C:\p\perf\out | Out-Null for ($i = 0; $i -lt $n; $i++) { $t0 = [DateTimeOffset]::Now.ToUnixTimeMilliseconds() node C:\p\wt\apps\server\src\bin.ts thread send --base-dir C:/p/home $id go --wait 2>&1 | Out-Null Start-Sleep 12 $t1 = [DateTimeOffset]::Now.ToUnixTimeMilliseconds() "{""run"":$i,""start"":$t0,""end"":$t1}" | Add-Content C:\p\perf\out\turn.jsonl } ===== sum.cjs const fs = require('fs'); const path = require('path'); const NL = String.fromCharCode(10); const [dir, outFile] = process.argv.slice(2); const spans = []; for (const f of fs.readdirSync(dir)) for (const l of fs.readFileSync(path.join(dir, f), 'utf8').split(NL)) { if (!l) continue; try { spans.push(JSON.parse(l)); } catch {} } const byId = new Map(spans.map((s) => [s.spanId, s])); const ms = (s) => Number(BigInt(s.startTimeUnixNano) / 1000000n); const root = (s) => { while (s.parentSpanId && byId.has(s.parentSpanId)) s = byId.get(s.parentSpanId); return s; }; const spawns = spans.filter((s) => s.name === 'VcsProcess.spawn' || s.name === 'runGitCommand'); const under = (s, name) => { let p = s; while (p.parentSpanId && byId.has(p.parentSpanId)) { p = byId.get(p.parentSpanId); if (p.name === name) return p; } return null; }; for (const l of fs.readFileSync(outFile, 'utf8').split(NL)) { if (!l) continue; const r = JSON.parse(l); const roots = new Map(); let refresh = 0, sdr = 0; const sdrMs = new Map(); const refreshMs = new Set(); for (const sp of spawns) { const t = ms(sp); if (t < r.start || t > r.end) continue; const rt = root(sp); roots.set(rt.name, (roots.get(rt.name) || 0) + 1); const rf = under(sp, 'RunFinalizationService.refresh'); if (rf) { refresh++; refreshMs.add(Math.round(rf.durationMs)); const d = under(sp, 'readStatusDetailsRemote'); if (d) { sdr++; sdrMs.set(d.spanId, Math.round(d.durationMs)); } } } let total = 0; for (const n of roots.values()) total += n; console.log(JSON.stringify({ run: r.run, totalGit: total, refreshGit: refresh, refreshMs: [...refreshMs], statusDetailsRemoteGit: sdr, statusDetailsRemoteReads: [...sdrMs.values()], roots: Object.fromEntries(roots) })); } ===== tree.cjs const fs = require('fs'); const NL = String.fromCharCode(10); const [rootName, ...files] = process.argv.slice(2); const spans = []; for (const f of files) for (const l of fs.readFileSync(f, 'utf8').split(NL)) { if (!l) continue; try { spans.push(JSON.parse(l)); } catch {} } const kids = new Map(); for (const s of spans) { if (!kids.has(s.parentSpanId)) kids.set(s.parentSpanId, []); kids.get(s.parentSpanId).push(s); } const ms = (s) => Number(BigInt(s.startTimeUnixNano) / 1000000n); const isGit = (s) => s.name === 'runGitCommand' || s.name === 'VcsProcess.spawn'; const gitUnder = (s) => (kids.get(s.spanId) || []).reduce((a, k) => a + (isGit(k) ? 1 : 0) + gitUnder(k), 0); const plumb = /^(VcsProcess|runGitCommand|processRunner|GitVcsDriver\.gitCommand|sqlite|sql\.|BEGIN|COMMIT|SAVEPOINT|RELEASE)/; const pick = spans.filter((s) => s.name === rootName && gitUnder(s) > 0)[+(process.env.N || 0)]; if (!pick) { console.log('none'); process.exit(); } const t0 = ms(pick); const walk = (s, d) => { const g = gitUnder(s); if (d > +(process.env.DEPTH || 6)) return; if (!plumb.test(s.name) || d === 0) console.log(' '.repeat(d * 2) + '+' + (ms(s) - t0) + ' ' + s.name + ' ' + Math.round(s.durationMs) + 'ms git=' + g); for (const k of (kids.get(s.spanId) || []).sort((a, b) => ms(a) - ms(b))) if (gitUnder(k) > 0 || isGit(k)) { if (!plumb.test(k.name)) walk(k, d + 1); } }; walk(pick, 0); ===== serve.cmd @echo off set T3CODE_DEV_SEED=0 cd /d C:\p\wt\apps\server node src/bin.ts serve --base-dir C:/p/home --port 4800 --host 127.0.0.1 > C:\p\server.log 2>&1 ===== setup.ps1 $ErrorActionPreference = 'Continue' New-Item -ItemType Directory -Force C:\p\repos, C:\p\home\userdata, C:\p\perf\out | Out-Null git clone --bare --no-local C:\Users\t3admin\t3code C:\p\repos\remote.git 2>&1 | Select -Last 1 git clone C:\p\repos\remote.git C:\p\repos\p0 2>&1 | Select -Last 1 Set-Location C:\p\repos\p0 git config user.name t; git config user.email t@example.com git checkout -b work 2>&1 | Out-Null git push -u origin work 2>&1 | Select -Last 1 (git ls-files | Measure-Object).Count $np = (node -p process.execPath).Replace('\','/') '{"providerInstances":{"devReplay":{"displayName":"Replay (dev)","driver":"acpRegistry","config":{"source":"local","commandPath":"' + $np + '","commandArgs":["C:/p/wt/apps/server/scripts/dev-replay-agent.ts"]}}}}' | Set-Content -Encoding ascii C:\p\home\userdata\settings.json Get-Content C:\p\home\userdata\settings.json