In most cases, you can improve the performance of a slow program by removing the bottleneck. The profiler is a tool that finds the bottleneck.
In order to add profiling to your Ruby program, you need to first load the Profile library using the command-line option -r profile.
Usage Syntax:
$ ruby -r profile [programfile] [arguments]
Example:
Here is the output generated from hello.rb file but this would not give you much idea so, you can try using a bigger program. Out put is shown with small font.