Class: Zold::Routines::Audit

Inherits:
Object
  • Object
show all
Defined in:
lib/zold/commands/routines/audit.rb

Overview

Audit and report as much as we can to the command line.

Author

Yegor Bugayenko ([email protected])

Copyright

Copyright © 2018 Yegor Bugayenko

License

MIT

Instance Method Summary collapse

Constructor Details

#initialize(opts, wallets, log: Log::NULL) ⇒ Audit

Returns a new instance of Audit.



32
33
34
35
36
# File 'lib/zold/commands/routines/audit.rb', line 32

def initialize(opts, wallets, log: Log::NULL)
  @opts = opts
  @wallets = wallets
  @log = log
end

Instance Method Details

#exec(_ = 0) ⇒ Object



38
39
40
41
42
43
44
45
46
47
# File 'lib/zold/commands/routines/audit.rb', line 38

def exec(_ = 0)
  sleep(60) unless @opts['routine-immediately']
  @log.info(
    'Audit: ' + [
      "memory used: #{Zold::Size.new(GetProcessMem.new.bytes.to_i)}",
      "threads total: #{Thread.list.count}",
      "wallets: #{@wallets.count}"
    ].join('; ')
  )
end