- Ruby Basics
- Ruby - Home
- Ruby - Overview
- Ruby - Environment Setup
- Ruby - Syntax
- Ruby - Classes and Objects
- Ruby - Variables
- Ruby - Operators
- Ruby - Comments
- Ruby - IF...ELSE
- Ruby - Loops
- Ruby - Methods
- Ruby - Blocks
- Ruby - Modules
- Ruby - Strings
- Ruby - Arrays
- Ruby - Hashes
- Ruby - Date & Time
- Ruby - Ranges
- Ruby - Iterators
- Ruby - File I/O
- Ruby - Exceptions
- Ruby Advanced
- Ruby - Object Oriented
- Ruby - Regular Expressions
- Ruby - Database Access
- Ruby - Web Applications
- Ruby - Sending Email
- Ruby - Socket Programming
- Ruby - Ruby/XML, XSLT
- Ruby - Web Services
- Ruby - Tk Guide
- Ruby - Ruby/LDAP Tutorial
- Ruby - Multithreading
- Ruby - Built-in Functions
- Ruby - Predefined Variables
- Ruby - Predefined Constants
- Ruby - Associated Tools
- Ruby Useful Resources
- Ruby - Quick Guide
- Ruby - Useful Resources
- Ruby - Discussion
- Ruby - Ruby on Rails Tutorial
Ruby Profiler
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. Output is shown with small font.
[root@ruby]# ruby -r profile hello.rb
Hello, Mac! % cumulative self self total time seconds seconds calls ms/call ms/call name 0.00 0.00 0.00 2 0.00 0.00 IO#write 0.00 0.00 0.00 2 0.00 0.00 Module#method_added 0.00 0.00 0.00 1 0.00 0.00 Hello#hello 0.00 0.00 0.00 1 0.00 0.00 Hello#initialize 0.00 0.00 0.00 1 0.00 0.00 Class#inherited 0.00 0.00 0.00 1 0.00 0.00 Kernel.puts 0.00 0.00 0.00 1 0.00 0.00 Class#new 0.00 0.01 0.00 1 0.00 10.00 #toplevel
ruby_associated_tools.htm
Advertisements