Class: Puppet::Util::Profiler::ObjectCounts Private

Inherits:
Logging show all
Defined in:
lib/puppet/util/profiler/object_counts.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Methods inherited from Logging

#initialize, #profile

Constructor Details

This class inherits a constructor from Puppet::Util::Profiler::Logging

Instance Method Details

#finish(before) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



8
9
10
11
12
13
14
15
16
# File 'lib/puppet/util/profiler/object_counts.rb', line 8

def finish(before)
  after = ObjectSpace.count_objects

  diff = before.collect do |type, count|
    [type, after[type] - count]
  end

  diff.sort.collect { |pair| pair.join(': ') }.join(', ')
end

#startObject

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



4
5
6
# File 'lib/puppet/util/profiler/object_counts.rb', line 4

def start
  ObjectSpace.count_objects
end