Linux Per-Process CPU Runtime Statistics

From NovaOrdis Knowledge Base
Revision as of 21:22, 2 May 2018 by Ovidiu (talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

External

Internal

Overview

To determine total time spend by the process in user and kernel modes:

total-time-proc = utime + stime

If we want to include time from children processes:

total-time-proc-plus-children = total-time-proc + cutime + cstime

Running time for process (in seconds)

 process-running-time(seconds) = system-uptime(seconds) - (starttime / USER_HZ)

CPU usage percentage:

cpu-usage = (total-time-proc-plus-children / USER_HZ) / process-running-time * 100

Tools

novaordis-linux collector