Vendor OpenClaw source as Adolf fork baseline
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Some checks failed
ClawSweeper Dispatch / dispatch (push) Has been cancelled
CodeQL / Security High (actions) (push) Has been cancelled
CodeQL / Security High (channel-runtime-boundary) (push) Has been cancelled
CodeQL / Security High (core-auth-secrets) (push) Has been cancelled
CodeQL / Security High (mcp-process-tool-boundary) (push) Has been cancelled
CodeQL / Security High (network-ssrf-boundary) (push) Has been cancelled
CodeQL / Security High (plugin-trust-boundary) (push) Has been cancelled
CodeQL / Security High (process-exec-boundary) (push) Has been cancelled
Docs Sync Publish Repo / sync-publish-repo (push) Has been cancelled
Docs / docs (push) Has been cancelled
OpenClaw Stable Main Closeout / Resolve stable release closeout inputs (push) Has been cancelled
OpenClaw Stable Main Closeout / Verify stable main closeout (push) Has been cancelled
Workflow Sanity / no-tabs (push) Has been cancelled
Workflow Sanity / actionlint (push) Has been cancelled
Workflow Sanity / generated-doc-baselines (push) Has been cancelled
CI / runner-admission (push) Has been cancelled
CI / preflight (push) Has been cancelled
CI / security-fast (push) Has been cancelled
CI / pnpm-store-warmup (push) Has been cancelled
CI / build-artifacts (push) Has been cancelled
CI / native-i18n (push) Has been cancelled
CI / ${{ matrix.check_name }} (push) Has been cancelled
CI / ${{ matrix.checkName }} (push) Has been cancelled
CI / checks-node-compat-node22 (push) Has been cancelled
CI / check-bundled-channel-config-metadata (push) Has been cancelled
CI / check-dependencies (push) Has been cancelled
CI / check-guards (push) Has been cancelled
CI / check-lint (push) Has been cancelled
CI / check-prod-types (push) Has been cancelled
CI / check-shrinkwrap (push) Has been cancelled
CI / check-test-types (push) Has been cancelled
CI / check-additional-boundaries-a (push) Has been cancelled
CI / check-additional-boundaries-bcd (push) Has been cancelled
CI / check-additional-extension-bundled (push) Has been cancelled
CI / check-additional-extension-channels (push) Has been cancelled
CI / check-additional-extension-package-boundary (push) Has been cancelled
CI / check-additional-runtime-topology-architecture (push) Has been cancelled
CI / check-session-accessor-boundary (push) Has been cancelled
CI / check-session-transcript-reader-boundary (push) Has been cancelled
CI / check-docs (push) Has been cancelled
CI / skills-python (push) Has been cancelled
CI / macos-swift (push) Has been cancelled
CI / ios-build (push) Has been cancelled
CI / ci-timings-summary (push) Has been cancelled
Native App Locale Refresh / Refresh native fa (push) Has been cancelled
Native App Locale Refresh / Refresh native fr (push) Has been cancelled
Native App Locale Refresh / Refresh native hi (push) Has been cancelled
Native App Locale Refresh / Refresh native id (push) Has been cancelled
Native App Locale Refresh / Refresh native it (push) Has been cancelled
Native App Locale Refresh / Refresh native ja-JP (push) Has been cancelled
Control UI Locale Refresh / plan (push) Has been cancelled
Control UI Locale Refresh / Refresh ${{ matrix.locale }} (push) Has been cancelled
Control UI Locale Refresh / Commit control UI locale refresh (push) Has been cancelled
Live Media Runner Image / Build live media runner image (push) Has been cancelled
Native App Locale Refresh / Refresh native ar (push) Has been cancelled
Native App Locale Refresh / Refresh native de (push) Has been cancelled
Native App Locale Refresh / Refresh native es (push) Has been cancelled
Native App Locale Refresh / Refresh native ko (push) Has been cancelled
Native App Locale Refresh / Refresh native nl (push) Has been cancelled
Native App Locale Refresh / Refresh native pl (push) Has been cancelled
Native App Locale Refresh / Refresh native pt-BR (push) Has been cancelled
Native App Locale Refresh / Refresh native ru (push) Has been cancelled
Native App Locale Refresh / Refresh native sv (push) Has been cancelled
Native App Locale Refresh / Refresh native th (push) Has been cancelled
Native App Locale Refresh / Refresh native tr (push) Has been cancelled
Native App Locale Refresh / Refresh native uk (push) Has been cancelled
Native App Locale Refresh / Refresh native vi (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-CN (push) Has been cancelled
Native App Locale Refresh / Refresh native zh-TW (push) Has been cancelled
Native App Locale Refresh / Commit native locale refresh (push) Has been cancelled
Plugin Init Scaffold Validation / Validate provider scaffold (push) Has been cancelled
Plugin NPM Release / preview_plugins_npm (push) Has been cancelled
Plugin NPM Release / Validate release publish approval (push) Has been cancelled
Plugin NPM Release / preview_plugin_pack (push) Has been cancelled
Plugin NPM Release / publish_plugins_npm (push) Has been cancelled
Sandbox Common Smoke / sandbox-common-smoke (push) Has been cancelled
Website Installer Sync / static (push) Has been cancelled
Website Installer Sync / linux-docker (push) Has been cancelled
Website Installer Sync / macos-installer (push) Has been cancelled
Website Installer Sync / windows-installer (push) Has been cancelled
Website Installer Sync / sync-website (push) Has been cancelled
Adolf is a fork/vendored clone of github.com/openclaw/openclaw (v2026.6.11), free to diverge. Tree copied sans upstream .git; upstream remote added for future syncs. Node pinned to 24 (.nvmrc); engines already require >=22.19. Preserves docs/ARCHITECTURE.md. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01LeqyaxJF2nbRXJtae2kNB2
This commit is contained in:
197
scripts/perf/summarize-cpuprofile.mjs
Normal file
197
scripts/perf/summarize-cpuprofile.mjs
Normal file
@@ -0,0 +1,197 @@
|
||||
#!/usr/bin/env node
|
||||
// Summarizes V8 CPU profile files by frame and module.
|
||||
import fs from "node:fs";
|
||||
import path from "node:path";
|
||||
import process from "node:process";
|
||||
import { pathToFileURL } from "node:url";
|
||||
import { parsePositiveInt } from "../lib/numeric-options.mjs";
|
||||
|
||||
const DEFAULT_LIMIT = 30;
|
||||
|
||||
export function usage() {
|
||||
return "Usage: scripts/perf/summarize-cpuprofile.mjs [--limit N] <profile...>";
|
||||
}
|
||||
|
||||
export function shouldPrintHelp(argv) {
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const arg = argv[index];
|
||||
if (arg === "--") {
|
||||
return false;
|
||||
}
|
||||
if (arg === "--limit") {
|
||||
const value = argv[index + 1];
|
||||
try {
|
||||
parsePositiveInt(value, "--limit");
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
index += 1;
|
||||
continue;
|
||||
}
|
||||
if (arg.startsWith("--limit=")) {
|
||||
try {
|
||||
parsePositiveInt(arg.slice("--limit=".length), "--limit");
|
||||
} catch {
|
||||
return false;
|
||||
}
|
||||
continue;
|
||||
}
|
||||
if (arg === "--help" || arg === "-h") {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Parses CPU profile file paths and --limit.
|
||||
*/
|
||||
export function parseArgs(argv) {
|
||||
const files = [];
|
||||
let limit = DEFAULT_LIMIT;
|
||||
for (let index = 0; index < argv.length; index += 1) {
|
||||
const arg = argv[index];
|
||||
if (arg === "--limit") {
|
||||
limit = parsePositiveInt(argv[(index += 1)], "--limit");
|
||||
continue;
|
||||
}
|
||||
if (arg.startsWith("--limit=")) {
|
||||
limit = parsePositiveInt(arg.slice("--limit=".length), "--limit");
|
||||
continue;
|
||||
}
|
||||
if (arg === "--") {
|
||||
files.push(...argv.slice(index + 1));
|
||||
break;
|
||||
}
|
||||
if (arg.startsWith("-")) {
|
||||
throw new Error(`Unknown option: ${arg}`);
|
||||
}
|
||||
files.push(arg);
|
||||
}
|
||||
return { files, limit };
|
||||
}
|
||||
|
||||
function formatUrl(url) {
|
||||
if (!url) {
|
||||
return "(native)";
|
||||
}
|
||||
const cwdPrefix = `${process.cwd()}${path.sep}`;
|
||||
return url
|
||||
.replace(/^file:\/\//u, "")
|
||||
.replace(cwdPrefix, "")
|
||||
.replace(/^.*\/node_modules\//u, "node_modules/")
|
||||
.replace(/^.*\/dist\//u, "dist/");
|
||||
}
|
||||
|
||||
function groupUrl(url) {
|
||||
const formatted = formatUrl(url);
|
||||
if (formatted.startsWith("node:")) {
|
||||
return formatted.split(":").slice(0, 2).join(":");
|
||||
}
|
||||
if (formatted.startsWith("node_modules/")) {
|
||||
return formatted.split("/").slice(0, 3).join("/");
|
||||
}
|
||||
if (formatted.startsWith("dist/")) {
|
||||
return formatted.split("/").slice(0, 2).join("/");
|
||||
}
|
||||
return formatted;
|
||||
}
|
||||
|
||||
function add(map, key, micros) {
|
||||
map.set(key, (map.get(key) ?? 0) + micros);
|
||||
}
|
||||
|
||||
function validateProfile(profile, file) {
|
||||
if (!profile || typeof profile !== "object" || Array.isArray(profile)) {
|
||||
throw new Error(`${file}: CPU profile must be a JSON object`);
|
||||
}
|
||||
if (!Array.isArray(profile.nodes) || profile.nodes.length === 0) {
|
||||
throw new Error(`${file}: CPU profile has no nodes`);
|
||||
}
|
||||
if (!Array.isArray(profile.samples) || profile.samples.length === 0) {
|
||||
throw new Error(`${file}: CPU profile has no samples`);
|
||||
}
|
||||
if (
|
||||
!Number.isFinite(profile.startTime) ||
|
||||
!Number.isFinite(profile.endTime) ||
|
||||
profile.endTime <= profile.startTime
|
||||
) {
|
||||
throw new Error(`${file}: CPU profile duration must be positive`);
|
||||
}
|
||||
}
|
||||
|
||||
export function summarizeProfile(file, limit) {
|
||||
const profile = JSON.parse(fs.readFileSync(file, "utf8"));
|
||||
validateProfile(profile, file);
|
||||
const nodes = new Map(profile.nodes.map((node) => [node.id, node]));
|
||||
const samples = Array.isArray(profile.samples) ? profile.samples : [];
|
||||
const deltas = Array.isArray(profile.timeDeltas) ? profile.timeDeltas : [];
|
||||
const byFrame = new Map();
|
||||
const byModule = new Map();
|
||||
|
||||
for (let index = 0; index < samples.length; index += 1) {
|
||||
const node = nodes.get(samples[index]);
|
||||
if (!node) {
|
||||
continue;
|
||||
}
|
||||
const frame = node.callFrame ?? {};
|
||||
const micros = deltas[index] ?? 1000;
|
||||
const url = formatUrl(frame.url ?? "");
|
||||
const line =
|
||||
typeof frame.lineNumber === "number" && frame.lineNumber >= 0
|
||||
? `:${frame.lineNumber + 1}`
|
||||
: "";
|
||||
const functionName = frame.functionName || "(anonymous)";
|
||||
add(byFrame, `${functionName}\t${url}${line}`, micros);
|
||||
add(byModule, groupUrl(frame.url ?? ""), micros);
|
||||
}
|
||||
if (byFrame.size === 0) {
|
||||
throw new Error(`${file}: CPU profile samples did not match profile nodes`);
|
||||
}
|
||||
|
||||
const durationMs = (profile.endTime - profile.startTime) / 1000;
|
||||
console.log(`\n${file}`);
|
||||
console.log(`duration_ms: ${durationMs.toFixed(1)} samples: ${samples.length}`);
|
||||
console.log("top_frames:");
|
||||
for (const [key, micros] of [...byFrame.entries()]
|
||||
.toSorted((left, right) => right[1] - left[1])
|
||||
.slice(0, limit)) {
|
||||
console.log(`${(micros / 1000).toFixed(1)}ms\t${key}`);
|
||||
}
|
||||
console.log("top_modules:");
|
||||
for (const [key, micros] of [...byModule.entries()]
|
||||
.toSorted((left, right) => right[1] - left[1])
|
||||
.slice(0, limit)) {
|
||||
console.log(`${(micros / 1000).toFixed(1)}ms\t${key}`);
|
||||
}
|
||||
}
|
||||
|
||||
function main() {
|
||||
if (shouldPrintHelp(process.argv.slice(2))) {
|
||||
console.log(usage());
|
||||
return;
|
||||
}
|
||||
let options;
|
||||
try {
|
||||
options = parseArgs(process.argv.slice(2));
|
||||
} catch (error) {
|
||||
console.error(error instanceof Error ? error.message : String(error));
|
||||
process.exit(1);
|
||||
}
|
||||
if (options.files.length === 0) {
|
||||
console.error(usage());
|
||||
process.exit(2);
|
||||
}
|
||||
try {
|
||||
for (const file of options.files) {
|
||||
summarizeProfile(file, options.limit);
|
||||
}
|
||||
} catch (error) {
|
||||
console.error(error instanceof Error ? error.message : String(error));
|
||||
process.exit(1);
|
||||
}
|
||||
}
|
||||
|
||||
if (process.argv[1] && import.meta.url === pathToFileURL(process.argv[1]).href) {
|
||||
main();
|
||||
}
|
||||
Reference in New Issue
Block a user