> ## Documentation Index
> Fetch the complete documentation index at: https://codspeed.io/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Performance Instruments

> Pick the instrument you want to use.

Instruments are a key component of CodSpeed. They are used to measure the
performance of your code using different techniques.

## Choosing an Instrument

Not sure which instrument to use? This decision tree will help you find the
right one:

```mermaid theme={null}
flowchart TD
    start["What do you want to measure?"] -->|"&nbsp;Execution Time&nbsp;"| time["Benchmark has I/O or runs longer than 5s?*"]
    start -->|"&nbsp;Memory Usage&nbsp;"| memory["Memory&nbsp;"]
    time -->|&nbsp;No&nbsp;| simulation["Simulation&nbsp;"]
    time -->|&nbsp;Yes&nbsp;| walltime["Walltime&nbsp;"]
    click simulation "/instruments/cpu"
    click walltime "/instruments/walltime"
    click memory "/instruments/memory"
```

* **[CPU Simulation](https://codspeed.io/docs/instruments/cpu.md)**: Simulates CPU behavior to measure
  performance, taking into account instructions executed, cache and memory
  access patterns. Benchmarks run only once for consistent, hardware-agnostic
  results.
* **[Walltime](https://codspeed.io/docs/instruments/walltime.md)**: Measures real-world execution time on
  bare-metal runners managed by CodSpeed, with low noise and high precision.
* **[Memory](https://codspeed.io/docs/instruments/memory.md)**: Captures detailed memory usage and heap
  allocations to help you identify and optimize allocations.

**\*** Simulation is the recommended default, but use Walltime when your
benchmark contains I/O (which can introduce variance in simulation) or is too
large (simulation adds overhead that slows down long-running benchmarks
significantly).

## Language Support

| | [CPU Simulation](https://codspeed.io/docs/instruments/cpu.md) | [Walltime](https://codspeed.io/docs/instruments/walltime.md) | [Memory](https://codspeed.io/docs/instruments/memory.md) |
| :- | :-: | :-: | :-: |
| [Python](https://codspeed.io/docs/benchmarks/python.md) | | | |
| [Rust](https://codspeed.io/docs/benchmarks/rust.md) | | | |
| [C++](https://codspeed.io/docs/benchmarks/cpp.md) | | | |
| [Node.js](https://codspeed.io/docs/benchmarks/nodejs/overview.md) | | | |
| [Go](https://codspeed.io/docs/benchmarks/go.md) | | | |
| [Java](https://codspeed.io/docs/benchmarks/java.md) | | | |
| [Kotlin](https://codspeed.io/docs/benchmarks/kotlin.md) | | | |
| [Scala](https://codspeed.io/docs/benchmarks/scala.md) | | | |

If you need an instrument that isn't available for your language yet, let us
know via [Discord](https://discord.gg/MxpaCfKSqF) or
[email our support](mailto:contact@codspeed.io).

## Executor Instruments

> [card] [CPU Simulation](https://codspeed.io/docs/instruments/cpu.md)
>
> Measure performance by simulating the CPU behavior

> [card] [Memory](https://codspeed.io/docs/instruments/memory.md)
>
> Track memory usage, allocations, and leaks in your benchmarks

> [card] [Walltime](https://codspeed.io/docs/instruments/walltime.md)
>
> Measure performance by measuring the real time taken

## Ad Hoc Instruments

> [!TIP]
>
> Those ad hoc instruments can be used on top of an executor instrument to
> measure specific performance metrics.

> [card] [Database Instrument](https://codspeed.io/docs/instruments/databases/overview.md)
>
> Measure the performance of database queries


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.