This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
> ps auxww | grep timeout-test ; sleep 1 ; ps auxww | grep timeout-test | |
eric 29741 92.1 5.2 66660 27444 pts/4 R+ 20:50 0:38 ruby timeout-test.rb | |
eric 29741 92.2 5.2 66656 27708 pts/4 R+ 20:50 0:39 ruby timeout-test.rb | |
> ps auxww | grep timeout-test ; sleep 5 ; ps auxww | grep timeout-test | |
eric 29741 92.9 5.5 68704 29220 pts/4 R+ 20:50 0:45 ruby timeout-test.rb | |
eric 29741 93.1 5.8 69728 30456 pts/4 R+ 20:50 0:50 ruby timeout-test.rb | |
> ps auxww | grep timeout-test ; sleep 5 ; ps auxww | grep timeout-test | |
eric 29741 92.3 5.9 70756 31340 pts/4 R+ 20:50 0:53 ruby timeout-test.rb | |
eric 29741 92.4 6.2 71776 32528 pts/4 R+ 20:50 0:58 ruby timeout-test.rb | |
> ruby -v |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class MemoryPrinter < RubyProf::AbstractPrinter | |
# Print a flat profile report to the provided output. | |
# | |
# output - Any IO oject, including STDOUT or a file. | |
# The default value is STDOUT. | |
# | |
# options - Hash of print options. See #setup_options | |
# for more information. | |
# | |
def print(output = STDOUT, options = {}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Thread ID: 9261400 | |
Total: 250423 Kb | |
self calls name | |
55060 Kb 215738 God::Logger#log | |
via Object#applog | |
54357 Kb 431476 String#% | |
via God::Logger#log | |
28095 Kb 359580 <Class::Time>#allocate | |
via <Class::Time>#now |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# NewRelic instrumentation for ThinkingSphinx | |
if defined? ActiveRecord | |
ActiveRecord::Base.class_eval do | |
class << self | |
add_method_tracer :search, 'ActiveRecord/#{self.name}/search' | |
add_method_tracer :search, 'ActiveRecord/search', :push_scope => false | |
add_method_tracer :search, 'ActiveRecord/all', :push_scope => false | |
add_method_tracer :search_count, 'ActiveRecord/#{self.name}/search_count' | |
add_method_tracer :search_count, 'ActiveRecord/search_count', :push_scope => false |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
WATCHERS = 10 | |
# Make sure pid directories exists | |
FileUtils.mkdir_p '/tmp/profiler-pids' | |
God.pid_file_directory = '/tmp/profiler-pids' | |
God::Logger.syslog = false | |
WATCHERS.times do |i| | |
God.watch do |w| |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Displaying top 20 most common line/class pairs | |
109371 total objects | |
109371 filled heap slots | |
114325 free heap slots | |
3572 /usr/lib/ruby/site_ruby/1.8/rubygems/specification.rb:186:String | |
3053 __null__:__null__:__node__ | |
1265 /usr/lib/ruby/1.8/x86_64-linux/openssl.so:__null__:__node__ | |
1248 /usr/lib/ruby/gems/1.8/specifications/passenger-2.2.5.gemspec:15:String | |
570 (eval):4:__node__ | |
448 /usr/lib/ruby/1.8/fileutils.rb:1578:__node__ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRYPT [93 : 0] eric@kibo:/home/eric/god-memory-testing > pprof --text /usr/bin/ruby god-2.hprof.0004.heap | |
Total: 7.9 MB | |
5.3 66.7% 66.7% 5.3 66.7% add_heap | |
2.0 24.9% 91.5% 2.0 24.9% ruby_xmalloc | |
0.3 3.6% 95.1% 0.3 3.6% ruby_re_compile_pattern | |
0.3 3.2% 98.3% 0.3 3.3% ruby_xrealloc | |
0.0 0.6% 98.8% 0.0 0.6% rb_thread_save_context | |
0.0 0.5% 99.4% 0.0 0.5% CRYPTO_malloc | |
0.0 0.3% 99.7% 0.0 0.3% _dl_new_object | |
0.0 0.1% 99.8% 0.0 0.1% CRYPTO_realloc |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
CRYPT [99 : 0] eric@kibo:/home/eric/god-memory-testing > pprof --text /usr/bin/ruby --base=god-3.hprof.0001.heap god-3.hprof.0002.heap | |
Total: 1.4 MB | |
1.0 72.0% 72.0% 1.0 72.0% ruby_xmalloc | |
0.4 26.5% 98.5% 0.4 27.6% ruby_xrealloc | |
0.0 1.6% 100.1% 0.0 1.6% rb_thread_save_context | |
0.0 0.4% 100.4% 0.0 0.4% ruby_re_copy_registers | |
0.0 0.0% 100.4% 0.0 0.1% sym_inspect | |
0.0 0.0% 100.4% 0.1 3.7% rb_obj_alloc | |
0.0 0.0% 100.4% 0.0 0.0% rb_define_class_id | |
0.0 0.0% 100.4% 0.9 62.9% all_iter_i |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$null = File.open('/dev/null', 'w') | |
threads = [] | |
max_threads = 5000 | |
loop do | |
threads << Thread.new do | |
str = 'x' * 500 | |
$null.write(str) | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'open3' | |
module ShellJob | |
@queue = :default | |
def self.perform(*args) | |
puts "$ #{args.join(' ')}" | |
Open3.popen3(*args) do |stdin, stdout, stderr| | |
puts stdout.read.inspect | |
end |