性能分析服务器

EasyProfiler MCP Server是一个用于分析性能分析文件(.prof)的服务器,提供多种工具来识别和解决性能问题。

  • by bivex
  • Go
  • 本地部署
  • 更新于
在 GitHub 查看 bivex/easyprofiler-mcp

使用说明

EasyProfiler MCP服务器

MCP(Model Context Protocol)用于分析EasyProfiler(.prof)配置文件的服务器。

✅ 测试 在一个真正的160MB文件上,有6M+块 ⚡ 准备使用 с克劳德桌面

机会

服务器提供以下性能分析工具:

工具

  1. load_profile -下载.prof文件进行分析

    • 参数: file_path (.prof文件的路径)
  2. get_lowest块 -返回最慢的执行块

    • 参数: limit (块数,默认为10)
  3. get_thread_statistics -按流分列的时间使用统计

    • 无参数
  4. 获取热点 热点-运行时间最长的函数

    • 参数: limit (默认值为10)
  5. 分析性能问题 -综合性能问题分析

    • 无参数
    • 检测:长时间锁定、线程不平衡、上下文切换

安装

go mod download
go build -o easyprofiler-mcp

使用

启动服务器

./easyprofiler-mcp

MCP客户端配置

将MCP客户端(例如Claude Desktop)添加到配置中:

{
  "mcpServers": {
    "easyprofiler": {
      "command": "/path/to/easyprofiler-mcp"
    }
  }
}

.prof文件格式

服务器支持EasyProfiler版本格式:

  • v1.0.0+
  • v1.3.0版本+
  • v2.0.0版本+
  • v2.1.0+

使用示例

  1. 下载配置文件:

    load_profile(file_path="/path/to/profile.prof")
    
  2. 获取问题分析:

    analyze_performance_issues()
    
  3. 查看最慢的块:

    get_slowest_blocks(limit=20)
    

查明的问题类型

  • 长时间封锁行动 -持续时间>100ms的锁定操作
  • 螺纹不平衡 流之间负载不平衡(差异>2x)
  • 上下文切换过多 -过多的上下文切换(>1000)
  • 热门功能 占总时间>10%的功能

许可证

麻省理工学院