Sha256: 38f91e2d88b1687009e90a953bd377e411f8a3d3f397bf06e83b014e7521133b

Contents?: true

Size: 742 Bytes

Versions: 22

Compression:

Stored size: 742 Bytes

Contents

require 'madvertise/sysconf'

ProcStat = Struct.new(
  :ppid,
  :pgrp,
  :session,
  :tty_nr,
  :tpgid,
  :flags,
  :minflt,
  :cminflt,
  :majflt,
  :cmajflt,
  :utime,
  :stime,
  :cutime,
  :cstime,
  :priority,
  :nice,
  :num_threads,
  :itrealvalue,
  :starttime,
  :vsize,
  :rss,
  :rsslim,
  :startcode,
  :endcode,
  :startstack,
  :kstkesp,
  :kstkeip,
  :signal,
  :blocked,
  :sigignore,
  :sigcatch,
  :wchan,
  :nswap,
  :cnswap,
  :exit_signal,
  :processor,
  :rt_priority,
  :policy,
  :delayacct_blkio_ticks,
  :guest_time,
  :cguest_time
)

class ProcStat
  def self.read
    stat = File.read("/proc/self/stat").chomp.split
    new(*stat[3..40].map(&:to_i))
  end

  def pagesize
    Sysconf.sysconf(:page_size)
  end
end

Version data entries

22 entries across 22 versions & 1 rubygems

Version Path
madvertise-ext-0.5.1 lib/madvertise/proc_stat.rb
madvertise-ext-0.5.0 lib/madvertise/proc_stat.rb