Class: RequireProf::MemorySampler::ShellPS

Inherits:
Object
  • Object
show all
Defined in:
lib/require_prof/memory_sampler.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ ShellPS

Returns a new instance of ShellPS.



52
53
54
# File 'lib/require_prof/memory_sampler.rb', line 52

def initialize(command)
  @command = command
end

Instance Method Details

#memory_usageObject



56
57
58
59
# File 'lib/require_prof/memory_sampler.rb', line 56

def memory_usage
  process = $$
  `#{@command} #{process}`.split("\n")[1].to_f rescue 0.0
end