All Projects → lukes → profiling

lukes / profiling

Licence: MIT license
Non-discriminatory profiling of Ruby code leveraging the ruby-prof gem

Programming Languages

ruby
36898 projects - #4 most used programming language
shell
77523 projects

Projects that are alternatives of or similar to profiling

Mtuner
MTuner is a C/C++ memory profiler and memory leak finder for Windows, PlayStation 4 and 3, Android and other platforms
Stars: ✭ 2,007 (+16625%)
Mutual labels:  memory, optimization, profiling
audria
audria - A Utility for Detailed Ressource Inspection of Applications
Stars: ✭ 35 (+191.67%)
Mutual labels:  profiler, memory, profiling
Loli profiler
Memory instrumentation tool for android app&game developers.
Stars: ✭ 179 (+1391.67%)
Mutual labels:  profiler, memory
Myperf4j
High performance Java APM. Powered by ASM. Try it. Test it. If you feel its better, use it.
Stars: ✭ 2,281 (+18908.33%)
Mutual labels:  profiler, profiling
profiler
Continuous profiling based on pprof
Stars: ✭ 221 (+1741.67%)
Mutual labels:  profiler, profiling
Tracy
C++ frame profiler
Stars: ✭ 3,115 (+25858.33%)
Mutual labels:  profiler, profiling
Unityheapexplorer
A Memory Profiler, Debugger and Analyzer for Unity 2019.3 and newer.
Stars: ✭ 179 (+1391.67%)
Mutual labels:  profiler, memory
Androidgodeye
An app performance monitor(APM) , like "Android Studio profiler", you can easily monitor the performance of your app real time in browser
Stars: ✭ 2,430 (+20150%)
Mutual labels:  profiler, optimization
Py Spy
Sampling profiler for Python programs
Stars: ✭ 7,709 (+64141.67%)
Mutual labels:  profiler, profiling
pylaprof
A Python sampling profiler for AWS Lambda functions (and not only).
Stars: ✭ 12 (+0%)
Mutual labels:  profiler, profiling
VisualProfiler-Unity
The Visual Profiler provides a drop in solution for viewing your mixed reality Unity application's frame rate, scene complexity, and memory usage.
Stars: ✭ 120 (+900%)
Mutual labels:  profiler, profiling
kokkos-tools
Kokkos C++ Performance Portability Programming EcoSystem: Profiling and Debugging Tools
Stars: ✭ 52 (+333.33%)
Mutual labels:  profiler, profiling
Hotspot
The Linux perf GUI for performance analysis.
Stars: ✭ 2,415 (+20025%)
Mutual labels:  profiler, profiling
Laravel Db Profiler
Database Profiler for Laravel Web and Console Applications.
Stars: ✭ 141 (+1075%)
Mutual labels:  profiler, profiling
Nlp profiler
A simple NLP library allows profiling datasets with one or more text columns. When given a dataset and a column name containing text data, NLP Profiler will return either high-level insights or low-level/granular statistical information about the text in that column.
Stars: ✭ 181 (+1408.33%)
Mutual labels:  profiler, profiling
Memprof
A memory profiler for Python. As easy as adding a decorator!
Stars: ✭ 115 (+858.33%)
Mutual labels:  profiler, memory
Coz
Coz: Causal Profiling
Stars: ✭ 2,719 (+22558.33%)
Mutual labels:  profiler, optimization
Memory Profiler
A memory profiler for Linux.
Stars: ✭ 2,422 (+20083.33%)
Mutual labels:  profiler, profiling
Scalene
Scalene: a high-performance, high-precision CPU, GPU, and memory profiler for Python
Stars: ✭ 4,819 (+40058.33%)
Mutual labels:  profiler, profiling
nodejs
Node.js in-process collectors for Instana
Stars: ✭ 66 (+450%)
Mutual labels:  memory, profiling

alt ruby_silhouette

Profiling

Non-discriminatory profiling for your MRI Ruby code. This gem is a small wrapper around the ruby-prof gem, which is its only dependency. It lets you do simple but powerful profiling of your friend's bad code.

Gem Version CircleCI

Installation

Add this line to your application's Gemfile:

gem 'profiling', "~> 4.0"

And then execute:

$ bundle

Or install it yourself as:

$ gem install profiling

Getting Started

Profile slow code from your friend or colleague like this:

Profiler.run do
  # Slow code here...
end

The next time you call the code it will be profiled and three files will be written into a directory called profiling.

Files Generated

File Description
graph.html Drill down into the call tree to see where the time is spent
stack.html See the profiled code as a nested stack
flat.txt List of all functions called, the time spent in each and the number of calls made to that function

Is it Fast?

No, no it's not. It's really slow. For especially gnarly, deeply nested code you will want to get up and get a coffee. This gem wraps ruby-prof which is partly written in C, so it's as fast as it can be.

Options

Use the configure method to set some options:

Profiler.configure({
  dir: '/tmp/my-dir',
  exclude_gems: true,
  exclude_standard_lib: true
})
Option Description Default
dir Directory the files will be created in (can be relative or absolute) "profiling"
exclude_gems Exclude ruby gems from the results false
exclude_standard_lib Exclude ruby standard library from results false

Rails Initializer

This initializer is recommended if you're planning to profile in Rails:

# config/initializer/profiling.rb
Profiler.configure({
  dir: Rails.root.join('tmp/profiling')
})

Conditional Profiling

Pass an argument if: to enable or disable profiling at run time:

Profiler.run(if: user.is_admin?) do
  # Slow code here...
end

Labels

Labels translate to sub directories that the files will be generated in. This is handy for profiling multiple things at once, preserving files between runs, or grouping profiling results logically.

Profiler.run("some-label") do
  # Slow code here...
end

Preserving files between runs

Keep old files by adding the current time in the label so new files are generated with each run:

Profiler.run("some-label-#{Time.now.to_i}") do
  # Slow code here...
end

Organizing

Use / in your labels to group profiling results together in directories:

Profiler.run("post/create") do
  # Slow code here...
end

Profiler.run("post/update") do
  # Slow code here...
end

Contributing

Bug reports and pull requests are welcome. Pull requests with passing tests are even better.

To run the test suite:

bundle exec rspec

License

The gem is available as open source under the terms of the MIT License.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].