Class: OsCtl::Cli::Top::JsonExporter
- Defined in:
- lib/osctl/cli/top/json_exporter.rb
Instance Attribute Summary
Attributes inherited from View
Instance Method Summary collapse
Methods inherited from View
Constructor Details
This class inherits a constructor from OsCtl::Cli::Top::View
Instance Method Details
#start ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/osctl/cli/top/json_exporter.rb', line 7 def start queue = OsCtl::Lib::Queue.new Signal.trap('USR1') do Thread.new { queue << nil } end loop do queue.pop(timeout: rate) queue.clear model.measure puts model.data.to_json $stdout.flush end end |