Skip to content

Commit 29fce92

Browse files
committed
documented the cpu-hogs sample tool.
1 parent 724b14d commit 29fce92

File tree

1 file changed

+53
-0
lines changed

1 file changed

+53
-0
lines changed

README.markdown

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ Table of Contents
5151
* [func-latency-distr](#func-latency-distr)
5252
* [ngx-count-conns](#ngx-count-conns)
5353
* [ngx-lua-count-timers](#ngx-lua-count-timers)
54+
* [cpu-hogs](#cpu-hogs)
5455
* [Installation](#installation)
5556
* [Author](#author)
5657
* [Copyright and License](#copyright-and-license)
@@ -1571,6 +1572,58 @@ Max pending timers: 1024
15711572

15721573
[Back to TOC](#table-of-contents)
15731574

1575+
cpu-hogs
1576+
--------
1577+
1578+
This tool can measure how CPU time is distributed across all the running processes (and kernel threads), showing the biggest hogs.
1579+
1580+
For example, on a quite idle system, you can see a lot of "swapper" task shown on the list:
1581+
1582+
```
1583+
# cpu-hogs.sxx
1584+
Tracing the whole system...
1585+
Hit Ctrl-C to end.
1586+
^C
1587+
nginx-frontend 9%
1588+
nginx-backend 4%
1589+
swapper/15 3%
1590+
swapper/23 3%
1591+
swapper/19 3%
1592+
swapper/12 3%
1593+
swapper/0 3%
1594+
swapper/13 3%
1595+
swapper/21 3%
1596+
swapper/16 3%
1597+
swapper/8 3%
1598+
swapper/5 3%
1599+
pdns 3%
1600+
...
1601+
```
1602+
1603+
while on a busy system, we may get something like this:
1604+
1605+
```
1606+
cpu-hogs.sxx --arg time=30
1607+
Tracing the whole system...
1608+
Please wait for 30 seconds...
1609+
1610+
nginx-frontend 52%
1611+
nginx-backend 15%
1612+
nginx-sslgate 6%
1613+
nginx-waf 5%
1614+
ktserver 2%
1615+
pdns 2%
1616+
swapper/0 1%
1617+
ktfs 1%
1618+
syslog-ng 1%
1619+
fancy-scheduler 1%
1620+
rh-reader 0%
1621+
```
1622+
1623+
Please note that 52% here, for example, means 52% of all of the CPU time actually *used*, instead of the total CPU capacity. Do not get confused.
1624+
1625+
[Back to TOC](#table-of-contents)
1626+
15741627
Installation
15751628
============
15761629

0 commit comments

Comments
 (0)