名称: 代码性能分析器 描述: 分析代码性能并识别瓶颈 允许使用的工具:
- Bash
- 读取
- 写入
- Grep
- Glob
代码性能分析器技能
目的
分析算法实现,识别性能瓶颈和优化机会。
能力
- 运行时性能分析
- 内存分析
- 缓存未命中分析
- 热点识别
- 优化建议
- 对比基准测试
目标流程
- 代码级优化
- 复杂度优化
- 内存优化
分析维度
时间分析
- 函数级计时
- 逐行性能分析
- 调用图分析
- 热点检测
内存分析
- 堆分配跟踪
- 内存泄漏检测
- 峰值内存使用量
- 分配模式
缓存分析
- 缓存未命中率
- 内存访问模式
- 数据局部性问题
输入模式
{
"type": "object",
"properties": {
"code": { "type": "string" },
"language": { "type": "string" },
"profileType": {
"type": "string",
"enum": ["time", "memory", "cache", "all"]
},
"testInput": { "type": "string" },
"iterations": { "type": "integer", "default": 1 }
},
"required": ["code", "profileType"]
}
输出模式
{
"type": "object",
"properties": {
"success": { "type": "boolean" },
"timing": { "type": "object" },
"memory": { "type": "object" },
"hotSpots": { "type": "array" },
"recommendations": { "type": "array" }
},
"required": ["success"]
}
集成
可与性能分析工具集成,如 gprof、perf、Valgrind、cProfile 以及特定语言的性能分析器。