Skip to content

Commit a313abf

Browse files
committed
Fix process hog metrics
Some of them were mathematically incorrect, for example: proc.hog.cpu = 100 * (rate(proc.psinfo.utime) + rate(proc.psinfo.stime)) / (kernel.all.uptime - proc.psinfo.start_time) This decays over time since the denominator grows while the numerator has a maximum limit. Fix the cpu/disk/net formulas to match the descriptions. Make help texts slightly more clearer and consistent while at it. Resolves: #2391
1 parent 7799f78 commit a313abf

1 file changed

Lines changed: 17 additions & 17 deletions

File tree

src/derived/proc.conf

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -4,33 +4,33 @@
44
proc.psinfo.age = kernel.all.uptime - proc.psinfo.start_time
55
proc.psinfo.age(oneline) = time in seconds since process was started
66
proc.psinfo.age(helptext) = '\
7-
time in seconds since process was started, calculated from
8-
proc.psinfo.start_time subtracted from kernel.all.uptime.'
7+
time in seconds since process was started, calculated
8+
as kernel.all.uptime minus proc.psinfo.start_time.'
99

10-
proc.io.total_bytes = instant(proc.io.read_bytes) + instant(proc.io.write_bytes) - instant(proc.io.cancelled_write_bytes)
10+
proc.io.total_bytes = instant(proc.io.read_bytes + proc.io.write_bytes - proc.io.cancelled_write_bytes)
1111
proc.io.total_bytes(oneline) = total bytes read and written by process
1212
proc.io.total_bytes(helptext) = '\
13-
total bytes read and written by the process, less cancelled written bytes.'
13+
total bytes read and written by process, minus cancelled written bytes.'
1414

1515
# metrics to identify resource hogs
16-
proc.hog.cpu = 100 * (rate(proc.psinfo.utime) + rate(proc.psinfo.stime)) / (kernel.all.uptime - proc.psinfo.start_time)
17-
proc.hog.cpu(oneline) = average percentage CPU utilization of each process
16+
proc.hog.cpu = 100 * instant(proc.psinfo.utime + proc.psinfo.stime) / (kernel.all.uptime - proc.psinfo.start_time)
17+
proc.hog.cpu(oneline) = average CPU utilization of process
1818
proc.hog.cpu(helptext) = '\
19-
average CPU utilization of each process expressed as a percentage
20-
of time since the process started.'
19+
average CPU utilization of process expressed as
20+
a percentage of time since process start.'
2121

2222
proc.hog.mem = proc.memory.vmrss + proc.memory.vmswap
23-
proc.hog.mem(oneline) = sum of resident and swapped memory used by the process
23+
proc.hog.mem(oneline) = sum of resident and swapped memory used by process
2424
proc.hog.mem(helptext) = '\
25-
amount of resident and swapped memory used by each process.'
25+
sum of resident and swapped memory used by process.'
2626

27-
proc.hog.disk = (rate(proc.io.read_bytes) + rate(proc.io.write_bytes) - rate(proc.io.cancelled_write_bytes)) / (kernel.all.uptime - proc.psinfo.start_time)
28-
proc.hog.disk(oneline) = average I/O rate of each process since it was started
27+
proc.hog.disk = instant(proc.io.read_bytes + proc.io.write_bytes - proc.io.cancelled_write_bytes) / (kernel.all.uptime - proc.psinfo.start_time)
28+
proc.hog.disk(oneline) = average I/O rate of process
2929
proc.hog.disk(helptext) = '\
30-
average I/O rate (reads and writes less cancelled writes) of each process
31-
since it was started.'
30+
average I/O rate of process (reads and writes minus cancelled writes)
31+
since process start.'
3232

33-
proc.hog.net = rate(bpf.proc.net.tcp.recv.bytes) + rate(bpf.proc.net.tcp.send.bytes) + rate(bpf.proc.net.udp.recv.bytes) + rate(bpf.proc.net.udp.send.bytes)
34-
proc.hog.net(oneline) = sum of network usage by the process
33+
proc.hog.net = rescale(instant(bpf.proc.net.tcp.recv.bytes + bpf.proc.net.tcp.send.bytes + bpf.proc.net.udp.recv.bytes + bpf.proc.net.udp.send.bytes), "Kbyte")
34+
proc.hog.net(oneline) = sum of network usage by process
3535
proc.hog.net(helptext) = '\
36-
sum of network usage (TCP/UDP recv/send) by each process.'
36+
sum of network usage (TCP/UDP recv/send) by process.'

0 commit comments

Comments
 (0)