Skip to content

Instantly share code, notes, and snippets.

@rickhull
Last active August 29, 2015 14:22
Show Gist options
  • Save rickhull/11a16be0dc1ceb4da886 to your computer and use it in GitHub Desktop.
Save rickhull/11a16be0dc1ceb4da886 to your computer and use it in GitHub Desktop.
# echo $GEM_PATH
# echo $GEM_HOME
# which ruby
/opt/rubies/ruby-2.1.3/bin/ruby
# which gem
/opt/rubies/ruby-2.1.3/bin/gem
# gem --version
2.2.2
# gem list | wc -l
125
# ruby-prof -m1 --exclude-common-cycles ./test.rb
Measure Mode: wall_time
Thread ID: 69960597197620
Fiber ID: 69960601582640
Total: 0.436150
Sort by: self_time
%self total self wait child calls name
3.75 0.021 0.016 0.000 0.001 325 Module#class_eval
2.71 0.012 0.012 0.000 0.000 1 JSON::Ext::Parser#parse
2.17 0.087 0.009 0.000 0.078 1909 MIME::Type#init_with
2.12 0.009 0.009 0.000 0.000 3818 Regexp#match
1.93 0.011 0.008 0.000 0.002 27381 Hash#[]
1.89 0.008 0.008 0.000 0.000 11454 String#gsub!
1.16 0.098 0.005 0.000 0.093 1909 MIME::Type#initialize
1.10 0.013 0.005 0.000 0.008 1909 <Class::MIME::Type>#i18n_key
#!/usr/bin/env ruby
require 'fog'
$ gem clean
Cleaning up installed gems...
Attempting to uninstall rest_client-1.7.3
Executables and scripts will remain installed.
Successfully uninstalled rest_client-1.7.3
Attempting to uninstall rack-1.5.2
Successfully uninstalled rack-1.5.2
Attempting to uninstall netrc-0.7.7
Successfully uninstalled netrc-0.7.7
Attempting to uninstall netrc-0.7.9
You have requested to uninstall the gem:
netrc-0.7.9
rest_client-1.8.3 depends on netrc (~> 0.7.7)
If you remove this gem, these dependencies will not be met.
Continue with Uninstall? [yN]
Unable to uninstall netrc-0.7.9:
Gem::DependencyRemovalException: Uninstallation aborted due to dependent gem(s)
Attempting to uninstall minitest-5.4.1
Successfully uninstalled minitest-5.4.1
Attempting to uninstall httpclient-2.4.0
Successfully uninstalled httpclient-2.4.0
Attempting to uninstall highline-1.6.21
Successfully uninstalled highline-1.6.21
Attempting to uninstall gitdis-0.0.2.1
Successfully uninstalled gitdis-0.0.2.1
Attempting to uninstall gitdis-0.1.0.1
Successfully uninstalled gitdis-0.1.0.1
Attempting to uninstall gitdis-0.1.0.2
Successfully uninstalled gitdis-0.1.0.2
Attempting to uninstall gitdis-0.1.0.3
Successfully uninstalled gitdis-0.1.0.3
Attempting to uninstall gitdis-0.1.0.4
Successfully uninstalled gitdis-0.1.0.4
Attempting to uninstall gitdis-0.1.1.2
Successfully uninstalled gitdis-0.1.1.2
Attempting to uninstall gitdis-0.1.1.3
Successfully uninstalled gitdis-0.1.1.3
Attempting to uninstall gitdis-0.1.1.4
Successfully uninstalled gitdis-0.1.1.4
Attempting to uninstall gitdis-0.1.1.5
Successfully uninstalled gitdis-0.1.1.5
Attempting to uninstall gitdis-0.1.1.6
Successfully uninstalled gitdis-0.1.1.6
Attempting to uninstall gitdis-0.1.1.7
Successfully uninstalled gitdis-0.1.1.7
Attempting to uninstall redis-3.1.0
Successfully uninstalled redis-3.1.0
Attempting to uninstall fog-terremark-0.0.3
Successfully uninstalled fog-terremark-0.0.3
Attempting to uninstall fog-softlayer-0.3.25
Successfully uninstalled fog-softlayer-0.3.25
Attempting to uninstall fog-sakuracloud-0.1.1
Successfully uninstalled fog-sakuracloud-0.1.1
Attempting to uninstall fog-core-1.25.0
Successfully uninstalled fog-core-1.25.0
Attempting to uninstall fog-1.25.0
Successfully uninstalled fog-1.25.0
Attempting to uninstall fog-1.28.0
Successfully uninstalled fog-1.28.0
Attempting to uninstall fog-serverlove-0.1.1
Successfully uninstalled fog-serverlove-0.1.1
Attempting to uninstall fog-storm_on_demand-0.1.0
Successfully uninstalled fog-storm_on_demand-0.1.0
Attempting to uninstall fog-ecloud-0.0.2
Successfully uninstalled fog-ecloud-0.0.2
Attempting to uninstall fog-terremark-0.0.4
Successfully uninstalled fog-terremark-0.0.4
Attempting to uninstall fog-vmfusion-0.0.1
Successfully uninstalled fog-vmfusion-0.0.1
Attempting to uninstall fog-voxel-0.0.2
Successfully uninstalled fog-voxel-0.0.2
Attempting to uninstall fog-profitbricks-0.0.1
Successfully uninstalled fog-profitbricks-0.0.1
Attempting to uninstall fog-radosgw-0.0.3
Successfully uninstalled fog-radosgw-0.0.3
Attempting to uninstall fog-sakuracloud-1.0.0
Successfully uninstalled fog-sakuracloud-1.0.0
Attempting to uninstall fog-softlayer-0.4.1
Successfully uninstalled fog-softlayer-0.4.1
Attempting to uninstall fog-brightbox-0.7.0
Successfully uninstalled fog-brightbox-0.7.0
Attempting to uninstall fog-aws-0.1.1
Successfully uninstalled fog-aws-0.1.1
Attempting to uninstall fog-xml-0.1.1
Successfully uninstalled fog-xml-0.1.1
Attempting to uninstall nokogiri-1.6.5
Successfully uninstalled nokogiri-1.6.5
Attempting to uninstall mini_portile-0.6.1
Successfully uninstalled mini_portile-0.6.1
Attempting to uninstall fog-json-1.0.0
Successfully uninstalled fog-json-1.0.0
Attempting to uninstall fog-core-1.29.0
Successfully uninstalled fog-core-1.29.0
Attempting to uninstall ffi-yajl-1.1.0
Successfully uninstalled ffi-yajl-1.1.0
Attempting to uninstall libyajl2-1.0.1
Successfully uninstalled libyajl2-1.0.1
Attempting to uninstall excon-0.42.0
Successfully uninstalled excon-0.42.0
Attempting to uninstall excon-0.45.1
Successfully uninstalled excon-0.45.1
Attempting to uninstall colorize-0.7.3
Successfully uninstalled colorize-0.7.3
Attempting to uninstall colorize-0.7.5
Successfully uninstalled colorize-0.7.5
Attempting to uninstall chef-11.16.2
Executables and scripts will remain installed.
Successfully uninstalled chef-11.16.2
Attempting to uninstall chef-12.1.2
Successfully uninstalled chef-12.1.2
Attempting to uninstall serverspec-2.14.0
Successfully uninstalled serverspec-2.14.0
Attempting to uninstall specinfra-2.27.0
Successfully uninstalled specinfra-2.27.0
Attempting to uninstall multi_json-1.10.1
Successfully uninstalled multi_json-1.10.1
Attempting to uninstall rspec_junit_formatter-0.2.0
Successfully uninstalled rspec_junit_formatter-0.2.0
Attempting to uninstall rspec-3.1.0
Successfully uninstalled rspec-3.1.0
Attempting to uninstall rspec-expectations-3.2.0
Successfully uninstalled rspec-expectations-3.2.0
Attempting to uninstall rspec-core-3.2.2
Successfully uninstalled rspec-core-3.2.2
Attempting to uninstall chef-zero-4.0
Successfully uninstalled chef-zero-4.0
Attempting to uninstall rack-1.6.0
Successfully uninstalled rack-1.6.0
Attempting to uninstall highline-1.7.1
Successfully uninstalled highline-1.7.1
Attempting to uninstall net-ssh-multi-1.2.0
Successfully uninstalled net-ssh-multi-1.2.0
Attempting to uninstall net-ssh-2.9.1
Successfully uninstalled net-ssh-2.9.1
Attempting to uninstall ohai-8.2.0
Successfully uninstalled ohai-8.2.0
Attempting to uninstall ffi-1.9.3
Successfully uninstalled ffi-1.9.3
Attempting to uninstall systemu-2.6.4
Successfully uninstalled systemu-2.6.4
Attempting to uninstall mime-types-2.4.3
Successfully uninstalled mime-types-2.4.3
Attempting to uninstall bundler-1.9.2
Successfully uninstalled bundler-1.9.2
Attempting to uninstall awesome_print-1.2.0
Successfully uninstalled awesome_print-1.2.0
Attempting to uninstall activesupport-4.1.6
Successfully uninstalled activesupport-4.1.6
Attempting to uninstall thread_safe-0.3.4
Successfully uninstalled thread_safe-0.3.4
Attempting to uninstall i18n-0.6.11
Successfully uninstalled i18n-0.6.11
Attempting to uninstall CFPropertyList-2.2.8
Successfully uninstalled CFPropertyList-2.2.8
Attempting to uninstall rspec-mocks-3.1.0
Successfully uninstalled rspec-mocks-3.1.0
Attempting to uninstall rspec-expectations-3.1.1
Successfully uninstalled rspec-expectations-3.1.1
Attempting to uninstall rspec-core-3.1.3
Successfully uninstalled rspec-core-3.1.3
Attempting to uninstall rest-client-1.6.7
Successfully uninstalled rest-client-1.6.7
Attempting to uninstall ohai-7.4.0
Successfully uninstalled ohai-7.4.0
Attempting to uninstall chef-zero-2.2
Successfully uninstalled chef-zero-2.2
Attempting to uninstall rspec-support-3.1.0
Successfully uninstalled rspec-support-3.1.0
Attempting to uninstall mixlib-shellout-1.4.0
Successfully uninstalled mixlib-shellout-1.4.0
Attempting to uninstall ffi-yajl-1.4.0
Successfully uninstalled ffi-yajl-1.4.0
Clean Up Complete
$ time ruby -rfog -e "puts 'hi'"
hi
real 0m0.470s
user 0m0.392s
sys 0m0.076s
$ ruby-prof -m1 --exclude-common-cycles /tmp/test.rb
Measure Mode: wall_time
Thread ID: 70001020048180
Fiber ID: 70001024420340
Total: 0.616044
Sort by: self_time
%self total self wait child calls name
3.32 0.020 0.020 0.000 0.000 17518 <Class::File>#file?
2.30 0.014 0.014 0.000 0.000 56593 Gem::StubSpecification#name
2.23 0.014 0.014 0.000 0.000 11778 <Class::File>#join
2.18 0.039 0.013 0.000 0.025 1103 Enumerable#find_all
2.07 0.031 0.013 0.000 0.019 19649 Gem::StubSpecification#activated?
1.96 0.089 0.012 0.000 0.077 1909 MIME::Type#init_with
1.74 0.011 0.011 0.000 0.000 1 JSON::Ext::Parser#parse
1.48 0.048 0.009 0.000 0.038 11950 *Enumerable#any?
1.36 0.013 0.008 0.000 0.001 325 Module#class_eval
1.35 0.008 0.008 0.000 0.000 11454 String#gsub!
1.30 0.008 0.008 0.000 0.000 5866 <Module::Gem>#default_dir
1.27 0.010 0.008 0.000 0.002 27381 Hash#[]
1.18 0.015 0.007 0.000 0.007 5594 Gem::BasicSpecification#full_require_paths
1.07 0.148 0.007 0.000 0.141 203 Enumerable#find
1.06 0.019 0.007 0.000 0.013 5734 Gem::Version#<=>
1.03 0.008 0.006 0.000 0.001 1964 Hash#merge
* indicates recursively called methods
$ gem list
*** LOCAL GEMS ***
activesupport (4.2.1, 4.1.6)
addressable (2.3.8)
awesome_print (1.6.1, 1.2.0)
berkshelf (3.2.4)
berkshelf-api-client (1.2.1)
bigdecimal (1.2.4)
binding_of_caller (0.7.2)
buff-config (1.0.1)
buff-extensions (1.0.0)
buff-ignore (1.1.1)
buff-ruby_engine (0.1.0)
buff-shell_out (0.2.0)
buildar (2.0.2.1)
builder (3.2.2)
bundler (1.10.1, 1.9.2)
celluloid (0.16.0)
celluloid-io (0.16.2)
CFPropertyList (2.3.1, 2.2.8)
chef (12.3.0, 12.1.2, 11.16.2)
chef-zero (4.2.1, 4.0, 2.2)
cleanroom (1.0.0)
coderay (1.1.0)
colorize (0.7.7, 0.7.5, 0.7.3)
debug_inspector (0.0.2)
deep_merge (1.0.1)
dep-selector-libgecode (1.0.2)
dep_selector (1.0.3)
diff-lcs (1.2.5)
domain_name (0.5.24)
erubis (2.7.0)
ethon (0.7.3)
excon (0.45.3, 0.45.1, 0.42.0)
faraday (0.9.1)
ffi (1.9.8, 1.9.3)
ffi-yajl (2.2.0, 1.4.0, 1.1.0)
fission (0.5.0)
fog (1.30.0, 1.28.0, 1.25.0)
fog-atmos (0.1.0)
fog-aws (0.1.2, 0.1.1)
fog-brightbox (0.7.1, 0.7.0)
fog-core (1.30.0, 1.29.0, 1.25.0)
fog-ecloud (0.1.1, 0.0.2)
fog-google (0.0.5)
fog-json (1.0.1, 1.0.0)
fog-local (0.2.1)
fog-powerdns (0.1.1)
fog-profitbricks (0.0.2, 0.0.1)
fog-radosgw (0.0.4, 0.0.3)
fog-riakcs (0.1.0)
fog-sakuracloud (1.0.1, 1.0.0, 0.1.1)
fog-serverlove (0.1.2, 0.1.1)
fog-softlayer (0.4.5, 0.4.1, 0.3.25)
fog-storm_on_demand (0.1.1, 0.1.0)
fog-terremark (0.1.0, 0.0.4, 0.0.3)
fog-vmfusion (0.1.0, 0.0.1)
fog-voxel (0.1.0, 0.0.2)
fog-xml (0.1.2, 0.1.1)
formatador (0.2.5)
gitdis (0.1.2.1, 0.1.1.7, 0.1.1.6, 0.1.1.5, 0.1.1.4, 0.1.1.3, 0.1.1.2, 0.1.0.4, 0.1.0.3, 0.1.0.2, 0.1.0.1, 0.0.2.1)
hashie (2.1.2)
highline (1.7.2, 1.7.1, 1.6.21)
hitimes (1.2.2)
http-cookie (1.0.2)
httpclient (2.6.0.1, 2.4.0)
i18n (0.7.0, 0.6.11)
inflecto (0.0.2)
io-console (0.4.2)
ipaddress (0.8.0)
json (1.8.2, 1.8.1)
libyajl2 (1.2.0, 1.0.1)
method_source (0.8.2)
mime-types (2.5, 2.4.3, 1.25.1)
mini_portile (0.6.2, 0.6.1)
minitar (0.5.4)
minitest (5.6.1, 5.5.1, 5.4.1, 4.7.5)
mixlib-authentication (1.3.0)
mixlib-cli (1.5.0)
mixlib-config (2.1.0)
mixlib-log (1.6.0)
mixlib-shellout (2.0.1, 1.4.0)
multi_json (1.11.0, 1.10.1)
multipart-post (2.0.0)
net-http-persistent (2.9.4)
net-scp (1.2.1)
net-ssh (2.9.2, 2.9.1)
net-ssh-gateway (1.2.0)
net-ssh-multi (1.2.1, 1.2.0)
netrc (0.10.3, 0.7.9, 0.7.7)
nio4r (1.1.0)
nokogiri (1.6.6.2, 1.6.5)
octokit (3.8.0)
ohai (8.3.0, 8.2.0, 7.4.0)
opennebula (4.10.1)
plist (3.1.0)
providence (0.0.2.5)
pry (0.10.1)
psych (2.0.5)
rack (1.6.1, 1.6.0, 1.5.2)
rake (10.4.2, 10.1.0)
rbvmomi (1.8.2)
rdoc (4.1.0)
redis (3.2.1, 3.1.0)
rest-client (1.8.0, 1.6.7)
rest_client (1.8.3, 1.7.3)
retryable (2.0.1)
ridley (4.1.2)
rspec (3.2.0, 3.1.0)
rspec-core (3.2.3, 3.2.2, 3.1.3)
rspec-expectations (3.2.1, 3.2.0, 3.1.1)
rspec-its (1.2.0)
rspec-mocks (3.2.1, 3.1.0)
rspec-support (3.2.2, 3.1.0)
rspec_junit_formatter (0.2.2, 0.2.0)
ruby-prof (0.15.8)
sawyer (0.6.0)
semverse (1.2.1)
serverspec (2.15.0, 2.14.0)
slop (4.1.0, 3.6.0)
solve (1.2.1)
specinfra (2.31.0, 2.27.0)
systemu (2.6.5, 2.6.4)
terminal-table (1.4.5)
test-unit (2.1.3.0)
thor (0.19.1)
thread_safe (0.3.5, 0.3.4)
timers (4.0.1)
trollop (2.0)
typhoeus (0.7.1)
tzinfo (1.2.2)
unf (0.1.4)
unf_ext (0.0.7.1)
uuidtools (2.1.5)
varia_model (0.4.0)
wmi-lite (1.0.0)
$ echo $GEM_PATH
/home/rwh/.gem/ruby/2.1.3:/opt/rubies/ruby-2.1.3/lib/ruby/gems/2.1.0
$ echo $GEM_HOME
/home/rwh/.gem/ruby/2.1.3
$ which ruby
/opt/rubies/ruby-2.1.3/bin/ruby
$ which gem
/opt/rubies/ruby-2.1.3/bin/gem
$ gem --version
2.2.2
$ gem list | wc -l
134
$ ruby-prof -m1 --exclude-common-cycles /tmp/test.rb
Measure Mode: wall_time
Thread ID: 69914849596180
Fiber ID: 69914852990020
Total: 125.055294
Sort by: self_time
%self total self wait child calls name
20.90 61.537 26.140 0.000 35.398 8552487 Enumerable#find_all
14.06 34.066 17.586 0.000 16.480 8788185 *Array#select
10.95 13.694 13.694 0.000 0.000 60988450 Gem::StubSpecification#name
8.50 10.631 10.631 0.000 0.000 52009187 Gem::Dependency#type
5.98 7.480 7.480 0.000 0.000 60883096 String#===
4.67 5.844 5.844 0.000 0.000 52011672 Symbol#==
3.33 51.084 4.167 0.000 46.917 505598 Gem::Specification#conflicts
3.11 8.753 3.889 0.000 4.864 1278425 Gem::Version#<=>
2.92 39.995 3.652 0.000 36.343 8788166 Gem::Specification#runtime_dependencies
1.82 2.280 2.280 0.000 0.000 8788166 Gem::Specification#dependencies
1.50 1.879 1.879 0.000 0.000 1603366 <Class::File>#file?
1.43 5.215 1.785 0.000 3.430 1885635 *Enumerable#any?
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment