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
[2 : 0] eric@morizo:/Users/eric > cat > 'this is a test.sh' | |
#!/bin/sh | |
echo "we are so cool" | |
[3 : 0] eric@morizo:/Users/eric > chmod 755 'this is a test.sh' | |
[4 : 0] eric@morizo:/Users/eric > irb | |
>> system "this is a test.sh" | |
=> false | |
>> system ["this is a test.sh", "this is a test.sh"] | |
we are so cool |
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
namespace :test do | |
task :populate_testopts do | |
if ENV['TESTNAME'].present? | |
ENV['TESTOPTS'] = ENV['TESTOPTS'] ? "#{ENV['TESTOPTS']} " : '' | |
ENV['TESTOPTS'] += "--name=#{ENV['TESTNAME'].inspect}" | |
end | |
end | |
end | |
%w(test:units test:functionals test:integration).each do |task_name| |
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
[alias] | |
up = !sh -c 'git pull && git --no-pager log --pretty=format:\"%Cred%ae %Creset- %C(yellow)%s %Creset(%ar)\" HEAD@{1}.. && echo' |
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
diff --git a/lib/god.rb b/lib/god.rb | |
index 388179a..df39592 100644 | |
--- a/lib/god.rb | |
+++ b/lib/god.rb | |
@@ -534,6 +531,9 @@ module God | |
watches = self.pending_watches.dup | |
self.pending_watches.clear | |
self.pending_watch_states.clear | |
+ | |
+ # make sure we quit capturing when we're done |
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
# | |
# Created by Eric Lindvall <[email protected]> | |
# | |
# WHAT: Provides a simple overview of memory allocation occuring during a | |
# require. | |
# | |
# For a longer explanation, see my post at: | |
# | |
# http://bitmonkey.net/post/308322913/tracking-initial-memory-usage-by-file-in-ruby | |
# |
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
> gdb --batch -ex 'disasrb_gc_force_recycle' ruby | |
Using host libthread_db library "/lib/libthread_db.so.1". | |
Undefined command: "disasrb_gc_force_recycle". Try "help". | |
CRYPT [22 : 0] eric@vox4:/home/eric > gdb --batch -ex 'disas rb_gc_force_recycle' ruby | |
Using host libthread_db library "/lib/libthread_db.so.1". | |
Dump of assembler code for function rb_gc_force_recycle: | |
0x08069ed2 <rb_gc_force_recycle+0>: push %ebp | |
0x08069ed3 <rb_gc_force_recycle+1>: mov %esp,%ebp | |
0x08069ed5 <rb_gc_force_recycle+3>: push %ebx | |
0x08069ed6 <rb_gc_force_recycle+4>: sub $0x10,%esp |
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
> ruby spec/memprof_spec.rb | |
Memprof | |
- should print stats to a file [FAILED] | |
- should allow calling ::stats multiple times [FAILED] | |
- should clear stats after ::stats! [FAILED] | |
- should collect stats via ::track | |
- should dump objects as json | |
- should raise error when calling ::stats or ::dump without ::start | |
spec/memprof_spec.rb:76: [BUG] Segmentation fault | |
ruby 1.8.7 (2009-06-12 patchlevel 174) [i686-linux], MBARI 0x8770, Ruby Enterprise Edition 2009.10 |
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
# Would be nice to be part of scout internals | |
def counter(name, value, options = {}) | |
current_time = Time.now | |
if data = memory(name) | |
last_time, last_value = data[:time], data[:value] | |
elapsed_seconds = current_time - last_time | |
# We won't log it if the value has wrapped or enough time hasn't | |
# elapsed |
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
(gdb) ruby objects classes | |
1 God::Registry | |
1 God::Socket | |
1 ActiveSupport::Inflector::Inflections | |
1 REXML::XMLDecl | |
1 Resolv::DNS::Config | |
1 Resolv::DNS | |
1 Resolv::Hosts | |
1 Resolv | |
1 Gem::CommandManager |
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
#!/usr/bin/env ruby | |
def fork_test(command) | |
pid = Kernel.fork do | |
exec command | |
end | |
puts "parent sees pid: #{pid}" | |
Process.waitpid(pid) | |
end |