v0.3.6 · MIT License

A .NET profiler
built for AI
coding agents._

Ask your agent "find why this is slow" or "where am I wasting memory?" and get an answer backed by real profiling data — no detours, no GUIs, no context switching.

Claude Code — install plugin
/plugin marketplace add kodroi/metreja-profiler-marketplace
/plugin install metreja-profiler@metreja-profiler-marketplace
Prerequisite — install CLI
$dotnet tool install -g Metreja.Tool
claude — agent session
You: "This endpoint takes 3 seconds, find out why"
Agent: Setting up profiling session...
Running with profiler attached...
Analyzing trace (42,381 events captured)...
ValidateInventory is your bottleneck —
1.8s self time across 47 calls.
Queries inventory per-item instead of batching.
Here's the fix:
// Before: N+1 query
foreach (var item in items) { GetInventory(item.Id); }
// After: batch
GetInventoryBatch(items.Select(i => i.Id));
01

How it works

Say it. Profile it. Fix it.

The plugin orchestrates the full profiling loop on your behalf. You describe the problem; Metreja instruments your app, captures a trace, and hands the analysis back to the agent.

01

You describe the problem

Tell the agent what's slow, what's allocating too much, or what you want to compare.

02

Plugin sets up a session

Metreja creates an isolated session config with the right filters for your codebase.

03

App runs with profiler

The profiler DLL attaches to your .NET runtime and captures method-level timing and allocation events.

04

Trace is analysed

The agent reads the NDJSON output and identifies hotspots, call trees, or memory pressure.

05

Fix is proposed

The agent explains the root cause and suggests a concrete code change, backed by numbers.

06

Fix is verified

Run again, diff the traces. The agent confirms whether the change actually helped.

02

Why Metreja

Everything your agent needs.
Nothing it doesn't.

01

No detour

Your agent profiles as part of fixing the problem. The full measure-analyze-fix loop runs without human intervention.

02

Finds the real bottleneck

Self-time analysis pinpoints the method that's actually slow, not the one that calls it. No more chasing callers up the stack.

03

Catches wastefulness

Excessive allocations, GC thrashing, memory pressure. See which types allocate the most and which methods trigger gen2 collections.

04

Proves the fix worked

Diff two traces. See the numbers. No guessing whether your change helped — analyze-diff gives you hard evidence.

05

Traces only your code

Filter by assembly, namespace, or class. Framework noise stays out, overhead stays low. Signal, not noise.

06

Reproducible

Session configs are isolated files. Re-run the same investigation anytime. Share sessions with teammates or your agent.

03

Under the hood

A CLI the agent
drives for you.

The plugin orchestrates five commands. Every output is machine-readable NDJSON — designed to be consumed by an agent, not a human. You can also run the CLI directly if you need to.

full CLI reference →
CommandWhat it does
metreja hotspotsRank methods by self time, call count, or allocations
metreja calltreeExpand a slow method into its full call tree
metreja callersFind who calls a method and how much time each contributes
metreja memoryGC counts, pause times, per-type allocation hotspots
metreja analyze-diffCompare two traces to verify a fix actually improved performance