Last active
October 14, 2015 19:26
-
-
Save jrafanie/636b5e14790b338f1522 to your computer and use it in GitHub Desktop.
Track allocations in ems refresh
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
# How to run: | |
# bundle exec evm:db:reset > /dev/null && bundle exec rails r setup_ems.rb && bundle exec rails r run_refresh.rb | |
def miq_trace(description = "") | |
require 'allocation_tracer' | |
ObjectSpace::AllocationTracer.setup(%i{type class}) | |
result = ObjectSpace::AllocationTracer.trace do | |
yield | |
nil | |
end | |
puts "All #{description.to_s + ' '}allocations" | |
result.sort_by { |_, v| -v[0] }[0..100].each {|k, v| | |
puts "#{v[0]}\t#{k[0]}:#{k[1]}\t#{k[2]}\t#{k[3]}\t#{k[4]}" | |
} | |
end | |
EmsRefresh.init_console(false) | |
miq_trace do | |
e = ExtManagementSystem.first | |
EmsRefresh.refresh(e) | |
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
EvmDatabase.seed_primordial | |
ExtManagementSystem.destroy_all | |
e = ManageIQ::Providers::InfraManager.create(:name => "small", :hostname => "10.12.20.65", :type => "ManageIQ::Providers::Vmware::InfraManager", :ipaddress => "10.12.20.65", :zone => Zone.default_zone) | |
e.update_authentication(:default => {:userid => "ASKME", :password => "ASKME"}) | |
puts e.verify_credentials |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment