分析 OpenClaw Gateway 重启时的各阶段耗时,生成性能报告并给出优化建议。
bc 计算器powershell
powershell -ExecutionPolicy Bypass -File <skill>/scripts/gateway-profile.ps1
bash
bash <skill>/scripts/gateway-profile.sh
当用户要求分析 Gateway 重启性能时,OpenClaw 代理应使用以下方式调用:
Windows:
text
exec(command="powershell -ExecutionPolicy Bypass -File <skill>/scripts/gateway-profile.ps1", elevated=true)
Linux:
text
exec(command="bash <skill>/scripts/gateway-profile.sh", elevated=true)
其中 <skill> 应替换为实际路径,例如:
/home/tstj/.openclaw/workspace/skills/gateway-restart-profilerC:\Users\<user>\.openclaw\workspace\skills\gateway-restart-profiler代理调用时会自动重启 Gateway(先 stop 再 start),监听日志解析各阶段耗时,生成 HTML 可视化报告和文本摘要。
阶段说明配置加载读取 openclaw.json身份验证连接认证服务HTTP服务启动 Web 服务CanvasCanvas 挂载MCP服务MCP 协议服务心跳服务心跳监控模型加载加载 AI 模型频道启动启动 QQ/Telegram 等频道插件系统加载插件
阶段耗时可能原因配置加载 > 30s配置文件过大或损坏身份验证 > 30s网络问题或认证服务故障模型加载 > 30sOllama 响应慢,建议换用 API 模式频道启动 > 30sQQ/Telegram 连接异常插件系统 > 30snpm 依赖缺失,需重新安装
C:\Users\<user>\AppData\Local\Temp\openclaw\~/.openclaw/logs/HTML 报告(用浏览器打开)包含:
控制台同时输出:
text
阶段耗时明细 (按耗时降序):
频道启动 45000ms (45s) ########################
模型加载 32000ms (32s) ################
配置加载 12000ms (12s) #########
优化建议:
- [频道启动] 检查QQ/Telegram连接是否正常
- [模型加载] Ollama响应慢,考虑换用API模式
[HTML图表报告已保存: ~/.openclaw/logs/gateway-profile-2026-04-12.html]
→ 用浏览器打开 HTML 文件查看可视化图表!