#
# pmrep(1) configuration file - see pmrep.conf(5)
#


# Compact metric specifications are of form (see pmrep(1)):
#pcp.metric.name = label,instances,unit/scale,type,width,precision,limit


#
# Mimic assorted pidstat(1) reports
#
[pidstat]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid           = UID,,,,8
upct                  = proc.psinfo.cpu.util.user
upct.label            = %%usr
upct.formula          = 100 * rate(proc.psinfo.utime)
upct.width            = 7
spct                  = proc.psinfo.cpu.util.sys
spct.label            = %%system
spct.formula          = 100 * rate(proc.psinfo.stime)
spct.width            = 7
gpct                  = proc.psinfo.cpu.util.guest_time
gpct.label            = %%guest
gpct.formula          = 100 * rate(proc.psinfo.guest_time)
gpct.width            = 7
wpct                  = proc.schedstat.waitpct
wpct.label            = %%wait
wpct.formula          = (rate(proc.schedstat.cpu_time) - rate(proc.schedstat.run_delay)) / rate(proc.schedstat.cpu_time)
wpct.width            = 7
allcpu                = proc.psinfo.alltime
allcpu.label          = %%CPU
allcpu.formula        = 100 * (proc.psinfo.utime + proc.psinfo.stime + proc.psinfo.guest_time)
allcpu.unit           = s
allcpu.width          = 7
proc.psinfo.processor = CPU,,,,5
proc.psinfo.cmd       = Command,,,,12

[pidstat-d]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid                      = UID,,,,8
proc.io.read_bytes               = kB_rd/s,,KB,,9
proc.io.write_bytes              = kB_wr/s,,KB,,9
proc.io.cancelled_write_bytes    = kB_ccwr/s,,KB,,9
proc.psinfo.delayacct_blkio_time = iodelay,,,,7,0
proc.psinfo.cmd                  = Command,,,,12

[pidstat-R]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid             = UID,,,,8
proc.psinfo.rt_priority = prio,,,,4
proc.psinfo.policy_s    = policy,,,,6
proc.psinfo.cmd         = Command,,,,12

[pidstat-r]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid         = UID,,,,8
proc.psinfo.minflt  = minflt/s,,,,9
proc.psinfo.maj_flt = majflt/s,,,,9
proc.memory.vmsize  = VSZ,,KB,,7
proc.memory.vmrss   = RSS,,KB,,7
mempct              = proc.memory.pct
mempct.label        = %%MEM
mempct.formula      = 100 * ((proc.memory.vmrss + proc.memory.vmswap) / hinv.physmem)
mempct.width        = 6
proc.psinfo.cmd     = Command,,,,12

[pidstat-s]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid           = UID,,,,8
proc.memory.vmstack   = StkSize,,,,7
# https://github.com/performancecopilot/pcp/issues/1246
proc.smaps.referenced = StkRef,,,,7
proc.psinfo.cmd       = Command,,,,12

[pidstat-u]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid           = UID,,,,8
upct                  = proc.psinfo.cpu.util.user
upct.label            = %%usr
upct.formula          = 100 * rate(proc.psinfo.utime)
upct.width            = 7
spct                  = proc.psinfo.cpu.util.sys
spct.label            = %%system
spct.formula          = 100 * rate(proc.psinfo.stime)
spct.width            = 7
gpct                  = proc.psinfo.cpu.util.guest_time
gpct.label            = %%guest
gpct.formula          = 100 * rate(proc.psinfo.guest_time)
gpct.width            = 7
wpct                  = proc.schedstat.waitpct
wpct.label            = %%wait
wpct.formula          = (rate(proc.schedstat.cpu_time) - rate(proc.schedstat.run_delay)) / rate(proc.schedstat.cpu_time)
wpct.width            = 7
allcpu                = proc.psinfo.alltime
allcpu.label          = %%CPU
allcpu.formula        = 100 * (proc.psinfo.utime + proc.psinfo.stime + proc.psinfo.guest_time)
allcpu.unit           = s
allcpu.width          = 7
proc.psinfo.processor = CPU,,,,5
proc.psinfo.cmd       = Command,,,,12

[pidstat-v]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid         = UID,,,,8
proc.psinfo.threads = threads,,,,7
proc.fd.count       = fd-nr,,,,7
proc.psinfo.cmd     = Command,,,,12

[pidstat-w]
header = yes
instinfo = no
unitinfo = no
globals = no
timestamp = yes
width = 9
precision = 2
delimiter = " "
repeat_header = auto
colxrow = "      PID"
proc.id.uid         = UID,,,,
proc.psinfo.vctxsw  = cswch/s,,/s,,
proc.psinfo.nvctxsw = nvcswch/s,,/s,,
proc.psinfo.cmd     = Command,,,,12
