perf_tools

Version, currently main branch1 version
  • main branchlatestMar 10, 2026

github.com/crystal-lang/perf-tools

An assortment of tools to track resources in Crystal applications

45 stars
0 dependents
License: MIT

Installation

# Add this to your shard.yml
dependencies:
  perf_tools:
    github: crystal-lang/perf-tools
    branch: main

main is a branch, not a release, so this tracks it rather than pinning a version.

Then run:

shards install

shard.yml

Crystal
~> 1.8
License
MIT
Author
Quinton Miller <nicetas.c@gmail.com>

Dependencies

This version declares no dependencies.

README

# perf-tools

An assortment of tools to track resources in Crystal applications.

## Usage

To log the number of allocations, objects, their sizes, or their linking graph:

```crystal
require "perf_tools/mem_prof"

PerfTools::MemProf.log_object_counts(STDOUT)
PerfTools::MemProf.log_object_sizes(STDOUT)
PerfTools::MemProf.log_allocations(STDOUT)
PerfTools::MemProf.pretty_log_allocations(STDOUT)
PerfTools::MemProf.pretty_log_object_graph(STDOUT)
```

To log all fibers:

```crystal
require "perf_tools/fiber_trace"

PerfTools::FiberTrace.log_fibers(STDOUT)
PerfTools::FiberTrace.pretty_log_fibers(STDOUT)
```

To print the runtime status of execution contexts and fibers:

```crystal
require "perf_tools/scheduler_trace"

PerfTools::SchedulerTrace.print_runtime_status
PerfTools::SchedulerTrace.every(5.seconds)
PerfTools::SchedulerTrace.on(Signal::USR1, details: true)
```

And for a full runtime status, with the yield stack of suspended fibers:

```crystal
require "perf_tools/fiber_trace"
require "perf_tools/scheduler_trace"

PerfTools::SchedulerTrace.print_runtime_status(details: true)
```

Check each tool's instructions for more information.

## Installation

Add this to your application's `shard.yml`:

```yml
development_dependencies:
  perf_tools:
    github: crystal-lang/perf-tools
```

## Contributing

1. Fork it ( <https://github.com/crystal-lang/perf-tools/fork> )
2. Create your feature branch (git checkout -b my-new-feature)
3. Commit your changes (git commit -am 'Add some feature')
4. Push to the branch (git push origin my-new-feature)
5. Create a new Pull Request