Sha256: 97a355b8d1c1d9819600e58fa710bb03a3e080974679f917054308611e3b3baf

Contents?: true

Size: 486 Bytes

Versions: 4

Compression:

Stored size: 486 Bytes

Contents

module SimpleProfiler
  class Event < Struct.new(:klass, :target, :method, :args, :started_at, :finalized_at, :memory_at_beginning, :memory_at_end)
    
    def total_time
      finalized_at - started_at
    end

    def used_memory
      memory_at_end - memory_at_beginning
    end

    def to_s
      separator = target == :class ? '.' : '#'
      "#{klass}#{separator}#{method} -> #{total_time.round(4)} sec. - #{used_memory}MB - (Total Memory: #{memory_at_end}MB)"
    end
  end
end

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
simple_profiler-0.2.0 lib/simple_profiler/event.rb
simple_profiler-0.1.2 lib/simple_profiler/event.rb
simple_profiler-0.1.1 lib/simple_profiler/event.rb
simple_profiler-0.1.0 lib/simple_profiler/event.rb