class

Ctop::Collectors::Proc

Inherits Ctop::Collectors::Base < Reference < Object

Collects process information with CPU usage tracking.

proc = Ctop::Collectors::Proc.new
sleep 1 # Allow baseline to establish
snapshot = proc.collect
snapshot.processes.first(10).each do |p|
  puts "#{p.name}: #{p.cpu_percent.round(1)}% CPU, #{p.memory_kb / 1024} MB"
end

Constructors

Instance methods

collect(limit : Int32) : Ctop::Snapshots::Proc

Collect with custom limit on number of processes returned.

Source
collect

Collect process list, sorted by CPU usage (default limit 100).

Source