Sha256: 8ce653e8e02f473a9c4f89ee0d99c4b437f549a53c183cc34306654f6f0cc3ad

Contents?: true

Size: 562 Bytes

Versions: 28

Compression:

Stored size: 562 Bytes

Contents

module Bluepill
  class ProcessStatistics    
    STRFTIME = "%m/%d/%Y %H:%I:%S"
    # possibly persist this data.
    def initialize
      @events = Util::RotationalArray.new(10)
    end

    def record_event(event, reason)
      @events.push([event, reason, Time.now])
    end

    def to_s
      str = []
      @events.each do |(event, reason, time)|
        str << "  #{event} at #{time.strftime(STRFTIME)} - #{reason || "unspecified"}"
      end
      if str.size > 0
        str << "event history:"
      end
      str.reverse.join("\n")
    end
  end
end

Version data entries

28 entries across 28 versions & 7 rubygems

Version Path
bluepill-0.0.46 lib/bluepill/process_statistics.rb
bluepill-0.0.45 lib/bluepill/process_statistics.rb
mwotton-bluepill-0.0.44 lib/bluepill/process_statistics.rb
ra-bluepill-0.0.48 lib/bluepill/process_statistics.rb
ra-bluepill-0.0.47 lib/bluepill/process_statistics.rb
ra-bluepill-0.0.46 lib/bluepill/process_statistics.rb
ra-bluepill-0.0.45 lib/bluepill/process_statistics.rb
ra-bluepill-0.0.44 lib/bluepill/process_statistics.rb
evented_bluepill-0.0.46 lib/bluepill/process_statistics.rb
bluepill-0.0.44 lib/bluepill/process_statistics.rb
sumskyi-bluepill-0.0.42.1 lib/bluepill/process_statistics.rb
sumskyi-bluepill-0.0.42.0 lib/bluepill/process_statistics.rb
bluepill-0.0.43 lib/bluepill/process_statistics.rb
bluepill-0.0.42 lib/bluepill/process_statistics.rb
bluepill-0.0.40 lib/bluepill/process_statistics.rb
dylanvaughn-bluepill-0.0.40 lib/bluepill/process_statistics.rb
dylanvaughn-bluepill-0.0.39 lib/bluepill/process_statistics.rb
bluepill-0.0.39 lib/bluepill/process_statistics.rb
bluepill-0.0.38 lib/bluepill/process_statistics.rb
bluepill-0.0.37 lib/bluepill/process_statistics.rb