> ## 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.

export const UnsupportedIcon = () => <Icon icon="xmark" color="#ef4444" />;

export const SupportedIcon = () => <Icon icon="check" color="#22c55e" />;

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](/instruments/cpu)**: 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](/instruments/walltime)**: Measures real-world execution time on
  bare-metal runners managed by CodSpeed, with low noise and high precision.
* **[Memory](/instruments/memory)**: 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](/instruments/cpu) | [Walltime](/instruments/walltime) | [Memory](/instruments/memory) |
| :------------------------------------- | :--------------------------------: | :-------------------------------: | :---------------------------: |
| [Python](/benchmarks/python)           |          <SupportedIcon />         |         <SupportedIcon />         |       <SupportedIcon />       |
| [Rust](/benchmarks/rust)               |          <SupportedIcon />         |         <SupportedIcon />         |       <SupportedIcon />       |
| [C++](/benchmarks/cpp)                 |          <SupportedIcon />         |         <SupportedIcon />         |       <SupportedIcon />       |
| [Node.js](/benchmarks/nodejs/overview) |          <SupportedIcon />         |         <SupportedIcon />         |       <SupportedIcon />       |
| [Go](/benchmarks/go)                   |         <UnsupportedIcon />        |         <SupportedIcon />         |      <UnsupportedIcon />      |
| [Java](/benchmarks/java)               |         <UnsupportedIcon />        |         <SupportedIcon />         |      <UnsupportedIcon />      |

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

<Columns cols={2}>
  <Card title="CPU Simulation" href="/instruments/cpu" icon="https://mintcdn.com/codspeed/DYQLS2JiztYwuRW0/assets/icons/dataflow-03-primary.svg?fit=max&auto=format&n=DYQLS2JiztYwuRW0&q=85&s=4a00d3a388b7a6892592a7f54d44466c" width="24" height="24" data-path="assets/icons/dataflow-03-primary.svg">
    Measure performance by simulating the CPU behavior
  </Card>

  <Card title="Memory" href="/instruments/memory" icon="https://mintcdn.com/codspeed/DYQLS2JiztYwuRW0/assets/icons/data-primary.svg?fit=max&auto=format&n=DYQLS2JiztYwuRW0&q=85&s=d73410b814160a15cf20f797c167af08" width="24" height="24" data-path="assets/icons/data-primary.svg">
    Track memory usage, allocations, and leaks in your benchmarks
  </Card>

  <Card title="Walltime" href="/instruments/walltime" icon="stopwatch">
    Measure performance by measuring the real time taken
  </Card>
</Columns>

## Ad Hoc Instruments

<Tip>
  Those ad hoc instruments can be used on top of an executor instrument to
  measure specific performance metrics.
</Tip>

<Columns cols={2}>
  <Card title="Database Instrument" href="/instruments/databases/overview" icon="database">
    Measure the performance of database queries
  </Card>
</Columns>
