careo (owner)

Revisions

gist: 225597 Download_button fork
public
Public Clone URL: git://gist.github.com/225597.git
Embed All Files: show embed
comparison.txt #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
ruby-prof
=========
 
  Thread ID: 2148364720
  Total: 71.501190
 
   %self total self wait child calls name
   22.00 15.73 15.73 0.00 0.00 421 OpenSSL::SSL::SSLSocket#sysread
   10.82 7.77 7.74 0.03 0.00 194 IO#sysread
    4.92 3.52 3.52 0.00 0.00 21 OpenSSL::SSL::SSLSocket#connect
    4.85 3.47 3.47 0.00 0.00 43 TCPSocket#initialize
    4.45 3.89 3.18 0.00 0.70 2969 DataObjects::Mysql::Command#execute_non_query
    2.52 1.80 1.80 0.00 0.00 499936 JSON::Ext::Generator::GeneratorMethods::String#to_json
    2.12 2.20 1.51 0.00 0.68 3602 DataObjects::Mysql::Command#execute_reader
    2.07 49.45 1.48 0.00 47.97 588436 Array#each-1
    1.26 1.36 0.90 0.00 0.46 123965 DataMapper::Repository#initialize
    1.18 7.60 0.84 0.00 6.76 25342 Hash#each
    1.05 1.67 0.75 0.00 0.92 1240749 Hash#[]
                    [... snip 70ish lines ...]
    0.18 0.79 0.13 0.00 0.66 12749 RightAws::RightAWSParser#tag_end
 
 
perftools
=========
 
Total: 1958 samples
     384 19.6% 19.6% 384 19.6% garbage_collector
     342 17.5% 37.1% 481 24.6% DataMapper::Adapters::DataObjectsAdapter#read_many
     272 13.9% 51.0% 310 15.8% DataMapper::Adapters::DataObjectsAdapter#execute
     103 5.3% 56.2% 115 5.9% JSON.generate
      75 3.8% 60.1% 153 7.8% Class#new
      42 2.1% 62.2% 57 2.9% Timeout.timeout
      32 1.6% 63.8% 32 1.6% Merb::Logger#flush
      22 1.1% 65.0% 53 2.7% RightAws::RightSaxParserCallback#on_end_element
      21 1.1% 66.0% 31 1.6% RightAws::RightAWSParser#tag_end
      16 0.8% 66.9% 16 0.8% Benchmark.times
      15 0.8% 67.6% 969 49.5% Array#each
      15 0.8% 68.4% 23 1.2% DataMapper::Query#initialize
 
parse-flat-ruby-prof.rb #
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
require 'rubygems'
require 'ruport'
 
filename = ARGV.shift
 
lines = File.readlines(filename).collect { |line| line.split(" ") }
 
outfile = File.open "#{filename}.csv", "w+"
 
thread_id = lines.shift
total = lines.shift
_blank = lines.shift
 
headers = lines.shift
headers << "module"
 
table = Table(*headers)
lines.each do |line|
  values = []
  
  5.times {values << line.shift.to_f}
  values << line.shift.to_i
  
  name = line.shift
  module_name = name.split("#")[0]
  values << name
  values << module_name
  
  table << values
end
 
# put the module name in front and drop the full method name
table.reorder(7,0,1,2,3,4,5)
 
puts table.to_s
filtered = table.sub_table do |r|
  r["%self"] > 0.1
end
 
grouping = Grouping filtered,:by => "module"
 
 
sum = grouping.summary "module",
  "%self" => lambda { |g| g.sigma("%self") }
  
puts sum.to_s