Graph Profile

Graph profiles show how long each method runs, which methods call it and which methods it calls. To understand how to read a graph profile, refer to the documentation for the text graph report.

The main advantage of an HTML graph format versus the text format is the use of hyperlinks to jump between methods. This makes it easier to understand the flow of control through a program and which methods take the most time.

Below is the output from running printers_test.rb reproduced in HTML.

Profile Report

Thread ID Total Time
21277412 8.766

Thread 21277412

%Total %Self Total Self Children Calls Name
100.00% 0.00% 8.77 0.00 8.77 1 #toplevel
    8.77 0.00 8.77 1/1 Object#run_primes
    8.77 0.00 8.77 1/1 #toplevel
100.00% 0.00% 8.77 0.00 8.77 1 Object#run_primes
    0.02 0.00 0.02 1/1 Object#make_random_array
    2.09 0.00 2.09 1/1 Object#find_largest
    6.66 0.00 6.66 1/1 Object#find_primes
    6.63 4.06 2.56 500/501 Object#is_prime
    2.09 0.00 2.09 1/501 Object#find_largest
99.48% 46.34% 8.72 4.06 4.66 501 Integer#upto
    0.00 0.00 0.00 61/61 Array#[]
    0.00 0.00 0.00 61/61 Fixnum#_
    2.09 2.09 0.00 61/61 Kernel.sleep
    1.24 1.24 0.00 250862/250862 Fixnum#==
    1.33 1.33 0.00 250862/250862 Fixnum#%
    6.66 0.01 6.64 1/1 Object#find_primes
75.93% 0.17% 6.66 0.01 6.64 1 Array#select
    6.64 0.01 6.63 500/500 Object#is_prime
    6.66 0.00 6.66 1/1 Object#run_primes
75.93% 0.00% 6.66 0.00 6.66 1 Object#find_primes
    6.66 0.01 6.64 1/1 Array#select
    6.64 0.01 6.63 500/500 Array#select
75.76% 0.17% 6.64 0.01 6.63 500 Object#is_prime
    0.00 0.00 0.00 500/501 Fixnum#-
    6.63 4.06 2.56 500/501 Integer#upto
    2.09 0.00 2.09 1/1 Object#run_primes
23.89% 0.00% 2.09 0.00 2.09 1 Object#find_largest
    0.00 0.00 0.00 1/501 Fixnum#-
    2.09 0.00 2.09 1/501 Integer#upto
    0.00 0.00 0.00 1/1 Array#first
    0.00 0.00 0.00 1/1 Array#length
    2.09 2.09 0.00 61/61 Integer#upto
23.89% 23.89% 2.09 2.09 0.00 61 Kernel.sleep
    1.33 1.33 0.00 250862/250862 Integer#upto
15.12% 15.12% 1.33 1.33 0.00 250862 Fixnum#%
    1.24 1.24 0.00 250862/250862 Integer#upto
14.13% 14.13% 1.24 1.24 0.00 250862 Fixnum#==
    0.02 0.00 0.02 1/1 Object#run_primes
0.18% 0.00% 0.02 0.00 0.02 1 Object#make_random_array
    0.02 0.02 0.00 1/1 Array#each_index
    0.00 0.00 0.00 1/1 Class#new
    0.02 0.02 0.00 1/1 Object#make_random_array
0.18% 0.18% 0.02 0.02 0.00 1 Array#each_index
    0.00 0.00 0.00 500/500 Kernel.rand
    0.00 0.00 0.00 500/500 Array#[]=
    0.00 0.00 0.00 500/501 Object#is_prime
    0.00 0.00 0.00 1/501 Object#find_largest
0.00% 0.00% 0.00 0.00 0.00 501 Fixnum#-
    0.00 0.00 0.00 1/1 Kernel.rand
0.00% 0.00% 0.00 0.00 0.00 1 Integer#to_int
    0.00 0.00 0.00 1/1 Object#find_largest
0.00% 0.00% 0.00 0.00 0.00 1 Array#first
    0.00 0.00 0.00 1/1 Class#new
0.00% 0.00% 0.00 0.00 0.00 1 Array#initialize
    0.00 0.00 0.00 1/1 Object#find_largest
0.00% 0.00% 0.00 0.00 0.00 1 Array#length
    0.00 0.00 0.00 1/1 Object#make_random_array
0.00% 0.00% 0.00 0.00 0.00 1 Class#new
    0.00 0.00 0.00 1/1 Array#initialize
    0.00 0.00 0.00 61/61 Integer#upto
0.00% 0.00% 0.00 0.00 0.00 61 Fixnum#_
    0.00 0.00 0.00 61/61 Integer#upto
0.00% 0.00% 0.00 0.00 0.00 61 Array#[]
    0.00 0.00 0.00 500/500 Array#each_index
0.00% 0.00% 0.00 0.00 0.00 500 Array#[]=
    0.00 0.00 0.00 500/500 Array#each_index
0.00% 0.00% 0.00 0.00 0.00 500 Kernel.rand
    0.00 0.00 0.00 1/1 Integer#to_int