bleak_house 3.7.1 → 4.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data.tar.gz.sig +0 -0
- data/CHANGELOG +2 -0
- data/Manifest +12 -66
- data/README +57 -20
- data/TODO +2 -2
- data/bin/bleak +1 -14
- data/bleak_house.gemspec +10 -16
- data/ext/{bleak_house/logger/build_ruby.rb → build_ruby.rb} +17 -7
- data/ext/build_snapshot.rb +4 -0
- data/ext/{bleak_house/logger/extconf.rb → extconf.rb} +1 -1
- data/ext/snapshot.c +157 -0
- data/ext/{bleak_house/logger/snapshot.h → snapshot.h} +2 -45
- data/lib/bleak_house.rb +5 -5
- data/lib/bleak_house/analyzer.rb +24 -2
- data/lib/bleak_house/hook.rb +25 -0
- data/ruby/bleak_house.patch +358 -0
- data/ruby/configure.patch +242 -0
- data/ruby/gc.patch +116 -0
- data/ruby/ruby-1.8.6-p114.tar.bz2 +0 -0
- data/ruby/valgrind.patch +136 -0
- data/test/benchmark/bench.rb +16 -0
- data/test/unit/test_bleak_house.rb +26 -27
- metadata +22 -86
- metadata.gz.sig +0 -0
- data/ext/bleak_house/logger/build_logger.rb +0 -3
- data/ext/bleak_house/logger/snapshot.c +0 -204
- data/init.rb +0 -3
- data/install.rb +0 -2
- data/lib/bleak_house/analyzer/analyzer.rb +0 -358
- data/lib/bleak_house/logger.rb +0 -2
- data/lib/bleak_house/logger/source.rb +0 -21
- data/lib/bleak_house/rails.rb +0 -6
- data/lib/bleak_house/rails/action_controller.rb +0 -17
- data/lib/bleak_house/rails/bleak_house.rb +0 -62
- data/lib/bleak_house/rails/dispatcher.rb +0 -36
- data/lib/bleak_house/support/core_extensions.rb +0 -61
- data/ruby/gc.c.patch +0 -27
- data/ruby/parse.y.patch +0 -16
- data/ruby/ruby-1.8.6-p110.tar.bz2 +0 -0
- data/test/integration/app/README +0 -203
- data/test/integration/app/Rakefile +0 -10
- data/test/integration/app/app/controllers/application.rb +0 -12
- data/test/integration/app/app/controllers/items_controller.rb +0 -6
- data/test/integration/app/app/helpers/application_helper.rb +0 -3
- data/test/integration/app/app/helpers/items_helper.rb +0 -2
- data/test/integration/app/app/views/items/index.rhtml +0 -2
- data/test/integration/app/config/boot.rb +0 -109
- data/test/integration/app/config/database.yml +0 -19
- data/test/integration/app/config/environment.rb +0 -15
- data/test/integration/app/config/environments/development.rb +0 -18
- data/test/integration/app/config/environments/production.rb +0 -19
- data/test/integration/app/config/environments/test.rb +0 -22
- data/test/integration/app/config/initializers/inflections.rb +0 -10
- data/test/integration/app/config/initializers/mime_types.rb +0 -5
- data/test/integration/app/config/routes.rb +0 -35
- data/test/integration/app/doc/README_FOR_APP +0 -2
- data/test/integration/app/public/404.html +0 -30
- data/test/integration/app/public/422.html +0 -30
- data/test/integration/app/public/500.html +0 -30
- data/test/integration/app/public/dispatch.cgi +0 -10
- data/test/integration/app/public/dispatch.fcgi +0 -24
- data/test/integration/app/public/dispatch.rb +0 -10
- data/test/integration/app/public/favicon.ico +0 -0
- data/test/integration/app/public/images/rails.png +0 -0
- data/test/integration/app/public/javascripts/application.js +0 -2
- data/test/integration/app/public/javascripts/controls.js +0 -963
- data/test/integration/app/public/javascripts/dragdrop.js +0 -972
- data/test/integration/app/public/javascripts/effects.js +0 -1120
- data/test/integration/app/public/javascripts/prototype.js +0 -4225
- data/test/integration/app/public/robots.txt +0 -5
- data/test/integration/app/script/about +0 -3
- data/test/integration/app/script/console +0 -3
- data/test/integration/app/script/destroy +0 -3
- data/test/integration/app/script/generate +0 -3
- data/test/integration/app/script/performance/benchmarker +0 -3
- data/test/integration/app/script/performance/profiler +0 -3
- data/test/integration/app/script/performance/request +0 -3
- data/test/integration/app/script/plugin +0 -3
- data/test/integration/app/script/process/inspector +0 -3
- data/test/integration/app/script/process/reaper +0 -3
- data/test/integration/app/script/process/spawner +0 -3
- data/test/integration/app/script/runner +0 -3
- data/test/integration/app/script/server +0 -3
- data/test/integration/app/test/functional/items_controller_test.rb +0 -8
- data/test/integration/app/test/test_helper.rb +0 -38
- data/test/integration/server_test.rb +0 -93
- data/test/misc/direct.rb +0 -13
@@ -1,38 +0,0 @@
|
|
1
|
-
ENV["RAILS_ENV"] = "test"
|
2
|
-
require File.expand_path(File.dirname(__FILE__) + "/../config/environment")
|
3
|
-
require 'test_help'
|
4
|
-
|
5
|
-
class Test::Unit::TestCase
|
6
|
-
# Transactional fixtures accelerate your tests by wrapping each test method
|
7
|
-
# in a transaction that's rolled back on completion. This ensures that the
|
8
|
-
# test database remains unchanged so your fixtures don't have to be reloaded
|
9
|
-
# between every test method. Fewer database queries means faster tests.
|
10
|
-
#
|
11
|
-
# Read Mike Clark's excellent walkthrough at
|
12
|
-
# http://clarkware.com/cgi/blosxom/2005/10/24#Rails10FastTesting
|
13
|
-
#
|
14
|
-
# Every Active Record database supports transactions except MyISAM tables
|
15
|
-
# in MySQL. Turn off transactional fixtures in this case; however, if you
|
16
|
-
# don't care one way or the other, switching from MyISAM to InnoDB tables
|
17
|
-
# is recommended.
|
18
|
-
#
|
19
|
-
# The only drawback to using transactional fixtures is when you actually
|
20
|
-
# need to test transactions. Since your test is bracketed by a transaction,
|
21
|
-
# any transactions started in your code will be automatically rolled back.
|
22
|
-
self.use_transactional_fixtures = true
|
23
|
-
|
24
|
-
# Instantiated fixtures are slow, but give you @david where otherwise you
|
25
|
-
# would need people(:david). If you don't want to migrate your existing
|
26
|
-
# test cases which use the @david style and don't mind the speed hit (each
|
27
|
-
# instantiated fixtures translates to a database query per test method),
|
28
|
-
# then set this back to true.
|
29
|
-
self.use_instantiated_fixtures = false
|
30
|
-
|
31
|
-
# Setup all fixtures in test/fixtures/*.(yml|csv) for all tests in alphabetical order.
|
32
|
-
#
|
33
|
-
# Note: You'll currently still have to declare fixtures explicitly in integration tests
|
34
|
-
# -- they do not yet inherit this setting
|
35
|
-
fixtures :all
|
36
|
-
|
37
|
-
# Add more helper methods to be used by all tests here...
|
38
|
-
end
|
@@ -1,93 +0,0 @@
|
|
1
|
-
|
2
|
-
require "#{File.dirname(__FILE__)}/../test_helper"
|
3
|
-
|
4
|
-
class ServerTest < Test::Unit::TestCase
|
5
|
-
|
6
|
-
RAILS_ROOT = HERE + "/integration/app"
|
7
|
-
PORT = 43039
|
8
|
-
URL = "http://localhost:#{PORT}/"
|
9
|
-
LOG = "#{HERE}/integration/app/log/production.log"
|
10
|
-
system("touch #{LOG}")
|
11
|
-
|
12
|
-
def test_server_start
|
13
|
-
assert_match(/Ok/, browse("items"))
|
14
|
-
end
|
15
|
-
|
16
|
-
def test_too_few_frames
|
17
|
-
browse("items")
|
18
|
-
assert_match(/Not enough frames/, analyze)
|
19
|
-
end
|
20
|
-
|
21
|
-
def test_enough_frames
|
22
|
-
11.times do
|
23
|
-
browse("items")
|
24
|
-
end
|
25
|
-
|
26
|
-
result = analyze
|
27
|
-
|
28
|
-
# XXX Doesn't test the caching mechanism
|
29
|
-
|
30
|
-
assert_match(/leaked per request \(9\)/, result)
|
31
|
-
assert_match(/items\/index\/GET leaked/mi, result)
|
32
|
-
assert_match(/Inspection samples/, result)
|
33
|
-
assert_match(/core rails leaked/, result)
|
34
|
-
assert_match(/Impact.*core rails/m, result)
|
35
|
-
assert_match(/Impact.*items\/index\/GET/mi, result)
|
36
|
-
end
|
37
|
-
|
38
|
-
private
|
39
|
-
|
40
|
-
# Mostly copied from Interlock's tests
|
41
|
-
|
42
|
-
def browse(url = "")
|
43
|
-
flag = false
|
44
|
-
begin
|
45
|
-
open(URL + url).read
|
46
|
-
rescue Errno::ECONNREFUSED, OpenURI::HTTPError => e
|
47
|
-
raise "#{e.to_s}: #{URL + url}" if flag
|
48
|
-
flag = true
|
49
|
-
sleep 3
|
50
|
-
retry
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
def analyze
|
55
|
-
ENV['INITIAL_SKIP'] = "2"
|
56
|
-
`#{HERE}/../bin/bleak #{HERE}/integration/app/log/bleak_house_production.dump`
|
57
|
-
end
|
58
|
-
|
59
|
-
def truncate
|
60
|
-
Dir["#{RAILS_ROOT}/log/bleak_house*"].each { |f| File.delete f }
|
61
|
-
system("> #{LOG}")
|
62
|
-
end
|
63
|
-
|
64
|
-
def log
|
65
|
-
File.open(LOG, 'r') { |f| f.read }
|
66
|
-
end
|
67
|
-
|
68
|
-
def setup
|
69
|
-
Process.fork do
|
70
|
-
Dir.chdir(RAILS_ROOT) do
|
71
|
-
ENV['RAILS_GEM_VERSION'] = ENV['MULTIRAILS_RAILS_VERSION']
|
72
|
-
exec("RAILS_ENV=production SAMPLE_RATE=0.5 BLEAK_HOUSE=1 script/server -p #{PORT} &> #{LOG}")
|
73
|
-
end
|
74
|
-
end
|
75
|
-
|
76
|
-
50.times do |n|
|
77
|
-
break if log =~ /available at 0.0.0.0:#{PORT}/
|
78
|
-
sleep(0.2)
|
79
|
-
raise "Server didn't start" if n == 49
|
80
|
-
end
|
81
|
-
|
82
|
-
truncate
|
83
|
-
end
|
84
|
-
|
85
|
-
def teardown
|
86
|
-
# Process.kill(9, pid) doesn't work because Mongrel has double-forked itself away
|
87
|
-
while (pids = `ps awx | grep #{PORT} | grep -v grep | awk '{print $1}'`.split("\n")).any?
|
88
|
-
pids.each {|pid| system("kill #{pid}")}
|
89
|
-
sleep(0.2)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
|
93
|
-
end
|
data/test/misc/direct.rb
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby-bleak-house
|
2
|
-
|
3
|
-
require 'rubygems'
|
4
|
-
require 'bleak_house/c'
|
5
|
-
$memlogger = BleakHouse::Logger.new
|
6
|
-
File.delete($logfile = "/tmp/log") rescue nil
|
7
|
-
|
8
|
-
puts 0
|
9
|
-
$memlogger.snapshot($logfile, "file", true)
|
10
|
-
puts 1
|
11
|
-
$memlogger.snapshot($logfile, "file/one", true)
|
12
|
-
puts 2
|
13
|
-
$memlogger.snapshot($logfile, "file/two", true)
|