SuperAPI AI 工具集

asynkron-profiler

编程与开发

查看项目

更新于 10-16 00:05

技能介绍

用途:Asynkron.Profiler 是开源免费的 dotnet 工具,面向命令行优先的 .NET 性能分析,可对 .NET 命令或已有跟踪文件生成纯文本摘要,便于在 CI、脚本和智能体工作流中使用。

主要能力:支持五种主模式——--cpu(采样热点)、--memory(GC 分配与按类型调用树)、--exception(抛出次数与抛出点树)、--contention(等待时间树)、--heap(通过 dotnet-gcdump 查看保留堆形态)。可用 --input 渲染已有的 .nettrace、.speedscope.json、.etlx 或 .gcdump 文件。输出可用 --root、--filter、--exception-type 及 --calltree-depth、--calltree-width、--calltree-self、--calltree-sibling-cutoff 等参数细化。

使用方式:先安装工具与前置依赖:dotnet tool install -g asynkron-profiler --prerelease、dotnet tool install -g dotnet-trace、dotnet tool install -g dotnet-gcdump,并用 asynkron-profiler --help、dotnet-trace --version、dotnet-gcdump --version 验证。建议先 dotnet build -c Release,再运行如 asynkron-profiler --cpu -- ./bin/Release/<tfm>/MyApp;框架依赖应用可用 asynkron-profiler --memory -- dotnet ./bin/Release/<tfm>/MyApp.dll;也可传入 .csproj 或 .sln 路径。渲染已有跟踪:asynkron-profiler --input ./profile-output/app.nettrace --cpu。报告默认写入 profile-output/。

适用场景:需要自动化、可复现的 CPU、分配、异常、争用或堆分析,以及把已有跟踪文件转为可读报告。

限制:上游目前以 .NET SDK 10.x 为支持基线;dotnet run 会产生包含还原与构建的噪声跟踪;工具是 dotnet-trace 与 dotnet-gcdump 的前端,缺少前置依赖或诊断 IPC 被阻止会导致失败;--heap 只反映保留堆形态,不含 CPU 或分配时间线;本技能针对启动的命令或已有跟踪文件,进程附加、计数器或原始跟踪编写应改用 profiling。