How do I get CPU usage from proc stat?

How do I get CPU usage from proc stat?
Answer
A more accurate way to calculate CPU usage, is
by reading the values from /proc/stat
, but most of the answers use only the first 4 fields from /proc/stat to calculate it (one example here). /proc/stat/ has 10 fields per CPU core as of Linux kernel 2.6.
 

Tìm kiếm

Back
Top