How fan-weibo/arkperf works
ArkPerf is an OpenHarmony performance-analysis agent with CLI, TUI, and desktop interfaces. A user task enters a shared application session, where the agent loop consults an LLM and dispatches tools. MCP-backed Python services collect cold-start, memory, CPU, jank, and full-experience measurements; the agent turns their results into an analysis and recommendations. Local file, command, and Harmony tools also support investigation and optimization. The README documents the measurement capabilities; sampled source confirms the MCP bridge and shared session architecture, but not each service’s internal wiring.
Main entry points: conn.go MCP client · app.go App assembly · registry.go Tool registry · loop.go Agent loop
Components 21
User interfaces
- CLI
cmd/arkperf/main.go - TUI
internal/frontend/tui/app.go - Desktop service
desktop/service.go - Desktop UI
desktop/frontend/src/App.vue
Agent runtime
- App assembly
internal/app/app.go - Session
internal/app/app.go - Session store
internal/kernel/session.go - Agent loop
internal/kernel/loop.go - Model provider
internal/kernel/provider.go - Tool registry
internal/kernel/registry.go - Analysis report
internal/kernel/loop.go
Tool execution
- MCP client
internal/mcp/conn.go - Local tools
internal/tools/fs.go - Harmony tools
internal/tools/harmony.go - Harmony domain
internal/domain/harmony/toolchain.go
Measurement services
- Cold-start service
mcp-servers/cold_start_server.py - Memory service
mcp-servers/memory_server.py - CPU service
mcp-servers/cpu_server.py - Jank service
mcp-servers/jank_server.py - Experience service
mcp-servers/agent_server.py
Other components
- Engineer
Connections 25
- Engineer → CLI: submits task
- Engineer → TUI: submits task
- Engineer → Desktop UI: submits task
- Desktop UI → Desktop service: calls service
- CLI → App assembly: creates session
- TUI → App assembly: uses session
- Desktop service → App assembly: bootstraps session
- App assembly → Tool registry: registers tools
- App assembly → MCP client: attaches services
- App assembly → Session: creates session
- Session → Session store: loads and saves
- Session → Agent loop: creates runner
- Agent loop → Model provider: requests completion
- Agent loop → Tool registry: dispatches tools
- Tool registry → MCP client: dispatches remote tools
- Tool registry → Local tools: dispatches local tools
- Tool registry → Harmony tools: dispatches Harmony tools
- Harmony tools → Harmony domain: uses toolchain
- MCP client → Cold-start service: calls tools
- MCP client → Memory service: calls tools
- MCP client → CPU service: calls tools
- MCP client → Jank service: calls tools
- MCP client → Experience service: calls tools
- Agent loop → Analysis report: forms response
- Analysis report → Engineer: presents findings