# [Identify and optimize code hotspots using Arm Performix through the Arm MCP Server](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/)

## In this learning path

- [Introduction](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/)
- [Understand AI-driven profiling with Arm Performix MCP tool](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/1-overview/)
- [Build the Mandelbrot example on Arm Neoverse](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/2-setup/)
- [Run Code Hotspots with an AI agent](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/3-run-hotspot/)
- [Optimize code with AI-driven profiling feedback](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/4-optimize/)
- [Next Steps](https://learn.arm.com/learning-paths/servers-and-cloud-computing/performix-mcp-agent/_next-steps/)

## About this Learning Path

| Skill level: | Advanced |
|--------------|----------|
| Reading time: | 30 min   |
| Last updated: | 31 Jul 2026 |

| Author: | Pareena Verma, Arm [GitHub](https://github.com/pareenaverma) [LinkedIn](https://linkedin.com/in/pareena-verma-7853607) |
|----------|--------------------------------------------------------------------------------------------------------|
| Arm IP: | [Neoverse](https://support.arm.com/?tab=compute-ip&Product%20Type=Infrastructure%20Processors) |
| Tags:   | [Performance and Architecture](https://learn.arm.com/tag/performance-and-architecture) [Linux](https://learn.arm.com/tag/linux) [Arm Performix](https://learn.arm.com/tag/arm-performix) [MCP](https://learn.arm.com/tag/mcp) [CPP](https://learn.arm.com/tag/cpp) [GitHub Copilot](https://learn.arm.com/tag/github-copilot) |

### Who is this for?
This is an advanced topic for developers who want to use AI-powered tools to automate performance profiling and optimization of C++ applications on Arm Neoverse servers.

### What will you learn?
Upon completion of this Learning Path, you will be able to:
- Describe how the Arm Performix tool in the Arm MCP Server enables AI-driven profiling workflows
- Configure a GitHub Copilot prompt file to run the Code Hotspots recipe on a remote Arm target
- Use an AI agent to interpret flame graph results and identify the hottest functions in a C++ application
- Apply AI-suggested optimizations to reduce application runtime on Arm Neoverse

### Prerequisites
Before starting, you will need the following:
- Completion of the [Automate x86-to-Arm application migration using Arm MCP Server](https://learn.arm.com/learning-paths/servers-and-cloud-computing/arm-mcp-server/) Learning Path, or equivalent familiarity with configuring the Arm MCP Server in an AI coding assistant
- Access to an Arm-based cloud instance running Linux, such as an AWS Graviton3 instance
- Access to Arm Performix configured with the remote Arm target. See the [Arm Performix install guide](https://learn.arm.com/install-guides/performix/) for setup instructions
- Basic understanding of C++

### Summary
You’ll combine the Arm MCP Server’s `apx_recipe_run` tool with an AI agent to run the complete Code Hotspots workflow on an Arm Neoverse target. First, you’ll build an intentionally unoptimized Mandelbrot C++ application on a remote Arm Linux target, then use a GitHub Copilot prompt file to run the Performix Code Hotspots recipe. The agent confirms target details, executes collection, and returns a flame graph with structured hotspot data to pinpoint the hottest functions. Guided by the agent, you’ll apply concrete code changes, such as math simplifications and enabling a higher optimization level, directly on the server over SSH. Then, you’ll re-run the recipe to compare results. The end-to-end flow keeps profiling, interpretation, and edits within a single AI-assisted loop.

### Frequently asked questions
<details>
<summary>Which prompt file should I use to run the Code Hotspots recipe?</summary>
Use the `arm-hotspots-optimization` prompt file from the Arm MCP Server repository with GitHub Copilot. It directs the agent to confirm the remote target, run the recipe, and return structured profiling results.
</details>

<details>
<summary>What result should I expect after the profiling run completes?</summary>
Expect a flame graph and a hotspot summary that highlights the hottest functions in the Mandelbrot application. Use these outputs to guide which code changes to apply first.
</details>

<details>
<summary>Should I compile the Mandelbrot example with optimizations before profiling?</summary>
No. The single-threaded, unoptimized build is intentional so the hotspot analysis produces a clear signal. The agent later proposes enabling `-O3` as part of the optimization pass.
</details>

<details>
<summary>How do I know the agent is targeting the correct machine?</summary>
The agent explicitly confirms your remote target details before running the Code Hotspots recipe. Review this confirmation and proceed only if it matches your intended Arm target.
</details>

<details>
<summary>What should I check if the Code Hotspots run fails to start?</summary>
Confirm that Arm Performix is configured with your remote Arm target and that the MCP Server can reach it over SSH. Also verify that the Mandelbrot application builds on the target system.
</details>
