{
  "markdown": "# `uniprof`\n\nuniprof simplifies CPU profiling for humans and AI agents. Profile any application without code changes or added dependencies.\n\n```bash\n# Profile and analyze any app in one step\nnpx uniprof python script.py\n```\n\n## Table of Contents\n\n- [Supported Platforms](#supported-platforms)\n- [System Requirements](#system-requirements)\n- [Installation](#installation)\n  - [MCP Server](#mcp-server)\n- [Quick Start](#quick-start)\n  - [Host vs. Container Modes](#host-vs-container-modes)\n- [Compiling with Debug Information](#compiling-with-debug-information)\n- [Documentation](#documentation)\n- [Credits](#credits)\n- [License](#license)\n\n## Supported Platforms\n\nuniprof implements a common interface over multiple profilers that specialize in different platforms and runtimes. It automatically detects which profiler to use based on the command being executed, runs the profiler, transforms the varying output formats into a single format, and runs statistical analysis on the data to identify hotspots.\n\n| Platform | Profiler | Container | Host | Min Version |\n|----------|----------|-----------|-------|-------------|\n| Python | [py-spy](https://github.com/benfred/py-spy) | ✅ | ✅ | Python 3.7+ |\n| Node.js | [0x](https://github.com/davidmarkclements/0x) | ✅ | ✅ | Node 14+ |\n| Ruby | [rbspy](https://github.com/rbspy/rbspy) | ✅ | ✅ | Ruby 2.5+ |\n| PHP | [Excimer](https://github.com/wikimedia/mediawiki-php-excimer) | ✅ | ✅ | PHP 7.2+ |\n| JVM | [async-profiler](https://github.com/async-profiler/async-profiler) | ✅ | ✅ | Java 8+ |\n| .NET | [dotnet-trace](https://github.com/dotnet/diagnostics) | ✅ | ✅ | .NET 5+ |\n| BEAM | [perf](https://perf.wiki.kernel.org) | ✅ | ✅* | OTP 24+ |\n| Native (macOS) | [Instruments](https://developer.apple.com/xcode/features/) | ❌ | ✅ | Xcode 14.3+ |\n| Native (Linux) | [perf](https://perf.wiki.kernel.org) | ✅ | ✅ | Linux 2.6.31+ |\n\n\\* Linux only for host mode\n\n## System Requirements\n\n**tl;dr:** macOS or Linux with Docker installed\n\nuniprof is designed to run on macOS and Linux but has primarily been developed & tested on macOS. If you find any bugs when running on Linux, please [report them](https://github.com/indragiek/uniprof/issues). Running on a Windows host is currenly not supported, but you can run on Linux installed on Windows via [WSL2](https://learn.microsoft.com/en-us/windows/wsl/install). Note that when using uniprof via WSL2, profiling native Windows executables is not supported, but you can still use the profilers for the higher level language runtimes like Python and Node.js.\n\nProfiling tools are often non-trivial to set up correctly and can require [elevated privileges](https://www.kernel.org/doc/html/v6.16/admin-guide/perf-security.html). To simplify set up and provide better isolation for the profiled code, uniprof defaults to using [Docker containers](https://github.com/indragiek?tab=packages&repo_name=uniprof) for each runtime that are pre-configured to run specific profiling tools. uniprof mounts your workspace in the container and executes the program with the profiler attached. uniprof also supports profiling outside the container if the host system has the profiling tools installed by running with the `--mode host` flag. The only case where containerized execution is not supported is when profiling a native Mach-O binary on macOS, since Apple Instruments cannot run inside a container.\n\n## Installation\n\n```bash\nnpm install -g uniprof\n```\n\n### MCP Server\n\n```bash\n# Install uniprof MCP server automatically\nuniprof mcp install claudecode\nuniprof mcp install cursor\nuniprof mcp install vscode\n```\n\n**Supported clients for auto-installation:** amp, claudecode, codex, cursor, gemini, vscode, zed\n\nIf auto-installation is not supported for your client, add an MCP server using the stdio transport with the command `npx -y uniprof mcp run`.\n\nFor detailed MCP documentation see [docs/mcp.md](docs/mcp.md).\n\n## Quick Start\n\n**Profile and analyze in one step**:\n```bash\n# Profile most languages and get immediate analysis\nuniprof python app.py\nuniprof node server.js\nuniprof ruby script.rb\nuniprof java -jar myapp.jar\nuniprof dotnet MyApp.dll\nuniprof ./my-native-app\n\n# Profile and visualize flamegraph in browser\nuniprof --visualize python app.py\n```\n\n**Save profiles to analyze and visualize later**:\n```bash\n# 1. Check environment (optional)\nuniprof bootstrap\n\n# 2. Record a profile\nuniprof record -o profile.json -- python app.py\nuniprof record -o profile.json -- node server.js\nuniprof record -o profile.json -- ruby script.rb\nuniprof record -o profile.json -- php script.php\nuniprof record -o profile.json -- java -jar myapp.jar\nuniprof record -o profile.json -- ./gradlew run\nuniprof record -o profile.json -- ./mvnw spring-boot:run\nuniprof record -o profile.json -- dotnet MyApp.dll\nuniprof record -o profile.json -- elixir script.exs\nuniprof record -o profile.json -- mix run\nuniprof record -o profile.json -- ./my-native-app\nuniprof record -o profile.json -- /Applications/MyApp.app\n\n# 3. Analyze profile data to find hotspots\nuniprof analyze profile.json\n\n# 4. Visualize flamegraph in the browser\nuniprof visualize profile.json\n```\n\nFor detailed command line options documentation see [docs/cli.md](docs/cli.md).\n\n### Host vs. Container Modes\n\nUse the `--mode` option to control how profiling runs:\n\n- **`auto` (default)**: Prefer container mode when Docker is available; otherwise use host.\n  - Language runtimes (Python/Node.js/Ruby/PHP/BEAM/JVM/.NET) default to container for zero-setup.\n  - Native on macOS with Mach-O binaries uses host (Instruments). ELF binaries on macOS are supported in container mode.\n  - Native on Linux defaults to container; host can be used if you prefer your local perf setup.\n- **`host`**: Force host-installed profilers.\n- **`container`**: Force Docker containers (not supported for macOS Instruments/Mach-O binaries).\n\n```bash\n# Auto mode (default)\nuniprof record -o profile.json -- python script.py\n\n# Force host profilers\nuniprof record --mode host -o profile.json -- python script.py\n\n# Force container mode\nuniprof record --mode container -o profile.json -- ./my-linux-app\n```\n\n## Compiling with Debug Information\n\nNative profiling requires debug information for meaningful results. Debug symbols enable the profiler to map memory addresses to function names, providing readable output instead of just hexadecimal addresses. Additionally, frame pointers improve call stack accuracy, especially for optimized code.\n\n| Compiler | DWARF Debug Info | Frame Pointers | Notes |\n|----------|------------------|----------------|-------|\n| **gcc** | `gcc -g -o myapp main.c` | `gcc -fno-omit-frame-pointer -o myapp main.c` | Use `-g3` for maximum debug info, `-ggdb` for GDB-specific extensions |\n| **clang** | `clang -g -o myapp main.cpp` | `clang -fno-omit-frame-pointer -o myapp main.cpp` | Use `-gfull` on macOS for complete debug info |\n| **swift** | `swiftc -g main.swift` | `swiftc -Xcc -fno-omit-frame-pointer main.swift` | Debug builds include symbols by default with `swift build` |\n| **cargo** | `cargo build` (debug mode)<br>`cargo build --release` + `[profile.release]`<br>`debug = true` | `RUSTFLAGS=\"-C force-frame-pointers=yes\" cargo build` | Debug builds include DWARF by default; for release builds, add `debug = true` to Cargo.toml |\n| **go** | `go build -gcflags=all=\"-N -l\"` | Built-in, always enabled | Go includes debug info by default; `-gcflags` disables optimizations for better debugging |\n| **zig** | `zig build-exe -O Debug main.zig` | `zig build-exe -fno-omit-frame-pointer main.zig` | Use `-O ReleaseSafe` with debug info for optimized builds with symbols |\n| **ghc** | `ghc -g -rtsopts main.hs` | `ghc -fno-omit-frame-pointer main.hs` | Use `-prof` for profiling builds; `-rtsopts` enables runtime profiling options |\n\n## Documentation\n\n- **[CLI Reference](docs/cli.md)**\n- **[Advanced Usage](docs/advanced.md)**\n- **[Platform Guides](docs/platforms/)**\n- **[MCP Server](docs/mcp.md)**\n\n## Credits\n\n- [py-spy](https://github.com/benfred/py-spy) (MIT) is used for Python profiling. Included in the [uniprof-python](https://github.com/indragiek/uniprof/pkgs/container/uniprof-python) image.\n- [0x](https://github.com/davidmarkclements/0x) (MIT) is used for Node.js profiling. Included in the [uniprof-nodejs](https://github.com/indragiek/uniprof/pkgs/container/uniprof-nodejs) image.\n- [rbspy](https://github.com/rbspy/rbspy) (MIT) is used for Ruby profiling. Included in the [uniprof-ruby](https://github.com/indragiek/uniprof/pkgs/container/uniprof-ruby) image.\n- [Excimer](https://www.mediawiki.org/wiki/Excimer) (Apache 2.0) is used for PHP profiling. Included in the [uniprof-php](https://github.com/indragiek/uniprof/pkgs/container/uniprof-php) image.\n- [async-profiler](https://github.com/async-profiler/async-profiler) (Apache 2.0) is used for JVM profiling. Included in the [uniprof-jvm](https://github.com/indragiek/uniprof/pkgs/container/uniprof-jvm) image.\n- [dotnet-trace](https://github.com/dotnet/diagnostics) (MIT) is used for .NET profiling. Included in the [uniprof-dotnet](https://github.com/indragiek/uniprof/pkgs/container/uniprof-dotnet) image.\n- [perf](https://perfwiki.github.io/main/) (GPL) is used for native profiling on Linux. Included in the [uniprof-native](https://github.com/indragiek/uniprof/pkgs/container/uniprof-native) and [uniprof-beam](https://github.com/indragiek/uniprof/pkgs/container/uniprof-beam) images.\n- [speedscope](https://github.com/jlfwong/speedscope) (MIT) is bundled with uniprof and used for flamegraph visualization\n\n## License\n\nAll uniprof source code in this repository is licensed under the **MIT License**. See `LICENSE`.\n\nuniprof downloads and runs [Docker images](https://github.com/indragiek?tab=packages&repo_name=uniprof) that bundle third-party software. The Dockerfiles used to build these images can be found in `containers/`. These images and their contents are not covered by the MIT license and are governed by their own licenses. uniprof does not grant rights to those components and does not relicense them.\n",
  "bytes": 10034,
  "sha": "1a0a4f08c0186ca9fc5625dcfaa858110e02ddb5294844600ecac4d14b57dabf",
  "repo_slug": "indragiek/uniprof",
  "fonte": "repo",
  "truncated": false,
  "api": "https://agentalog.com/api/listings/mcp_io_github_indragiek_uniprof_73b299d4/readme"
}