Class: Abstractive::Esto
- Inherits:
-
Actor
- Object
- Actor
- Abstractive::Esto
- Extended by:
- Forwardable
- Defined in:
- lib/abstractive/esto.rb
Constant Summary collapse
- MONITORS =
{ uptime: 90, thread_survey: 30, thread_report: 15, thread_summary: 3, memory_count: 13, threads_and_memory: 45 }
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options = {}) ⇒ Esto
constructor
A new instance of Esto.
- #memory_count! ⇒ Object
- #start ⇒ Object
- #thread_report! ⇒ Object
- #thread_summary! ⇒ Object
- #thread_survey! ⇒ Object
- #threads_and_memory! ⇒ Object
- #uptime! ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ Esto
Returns a new instance of Esto.
29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/abstractive/esto.rb', line 29 def initialize(={}) @semaphor = {} @status = {} @timers = {} @short = .fetch(:short, false) @debug = .fetch(:debug, false) @logger = .fetch(:logger, nil) @declare = .fetch(:declare, false) @intervals = MONITORS.dup = @running = Hitimes::Interval.now async.start end |
Class Method Details
.start!(options = {}) ⇒ Object
13 14 15 16 17 |
# File 'lib/abstractive/esto.rb', line 13 def start!(={}) name = .delete(:name) || :esto Abstractive::Esto.supervise(as: name, args: []) Celluloid[name] end |
Instance Method Details
#memory_count! ⇒ Object
77 78 79 |
# File 'lib/abstractive/esto.rb', line 77 def memory_count! trigger!(:memory_count) { console memory } end |
#start ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/abstractive/esto.rb', line 43 def start if [:monitors].is_a?(Array) debug("Monitors:") if @debug [:monitors].each { |monitor| debug("* #{monitor} every #{readable_duration(MONITORS[monitor])}.") if @debug send("start_#{monitor}!") } else debug("No preconfigured monitors.") if @debug end end |
#thread_report! ⇒ Object
89 90 91 |
# File 'lib/abstractive/esto.rb', line 89 def thread_report! trigger!(:thread_report) { console threads } end |
#thread_summary! ⇒ Object
85 86 87 |
# File 'lib/abstractive/esto.rb', line 85 def thread_summary! trigger!(:thread_summary) { print " #{Thread.list.count} " } end |
#thread_survey! ⇒ Object
81 82 83 |
# File 'lib/abstractive/esto.rb', line 81 def thread_survey! trigger!(:thread_survey) { Celluloid.stack_summary } end |
#threads_and_memory! ⇒ Object
93 94 95 |
# File 'lib/abstractive/esto.rb', line 93 def threads_and_memory! trigger!(:threads_and_memory) { console "#{threads}; #{memory}" } end |
#uptime! ⇒ Object
73 74 75 |
# File 'lib/abstractive/esto.rb', line 73 def uptime! trigger!(:uptime) { console "#{(@short ? "U" : "Uptime")}: #{readable_duration(@running.duration_so_far)}" } end |