/proc/stat CPU 정보

Gunjoo Ahn·2022년 8월 11일
0

Example output from /proc/stat

$ cat /proc/stat
cpu 1279636934 73759586 192327563 12184330186 543227057 56603 68503253 0 0
cpu0 297522664 8968710 49227610 418508635 72446546 56602 24904144 0 0
cpu1 227756034 9239849 30760881 424439349 196694821 0 7517172 0 0
cpu2 86902920 6411506 12412331 769921453 17877927 0 4809331 0 0
...
intr 47965531372 1240248033 2 0 0 0 0 0 0 1 0 0 0 4 0 0 0 0 128 0 0 0 360 38 0 0 0 ...
swap 72080475 70517875 ctxt 113062355059 btime 1423804268 realbtime 1423804268
processes 139640565
procs_running 3
procs_blocked 0
softirq 103392583578 0 3105824580 7624540 1792771145 2125464967 0 290942924 2131429539 52132004 3692080663

CPU line 컬럼

ColumnNameDescriptionKerenel
1userTime spent with normal processing in user mode.
2niceTime spent with niced processes in user mode.
3systemTime spent running in kernel mode.
4idleTime spent in vacations twiddling thumbs. ( CPU가 놀고있는 상태 )
5iowaitTime spent waiting for I/O to completed. This is considered idle time too.since 2.5.41
6irqTime spent serving hardware interrupts.since 2.6.0
7softirqTime spent serving software interrupts.since 2.6.0
8stealTime stolen by other operating systems running in a virtual environment.since 2.6.11
9guestTime spent for running a virtual CPU or guest OS under the control of the kernel. With normal propertysince 2.6.24
10guest_niceTime spent on processes running on a virtual CPU with niced priority

Nice - “Niced” refers to the Unix command nice which allows you to designate user mode processes with a lower priority than others. By default, user processes are launched with priority 0. Using nice, you can assign a value greater than 0 (which corresponds to lower priority) which will tell your computer to provide processor time to this process only after processes with higher priority get their time.
Nice 우선순위 값의 범위는 -20, 19 로 -20이 가장 높고 19가 가장 낮다.

Interrupt - Interrupts are events where the processor is informed of another process requiring processor time. This might occur if, for instance, a processor is running a user mode process and a kernel mode process (e.g. hardware event, like a disk being pulled out) requires processor time.
Hardware interrupt vs Software interrupt

각 필드는 리눅스의 시간 표시 단위인 jiffy로 나타낸다.
Jiffy: system timer interrupt에 의한 one tick를 나타내는 단위. 기본적으로 100Hz (0.01초)

그 외 추가 정보

The "intr" line gives counts of interrupts serviced since boot time, for each of the possible system interrupts. The first column is the total of all interrupts serviced; each subsequent column is the total for that particular interrupt.

The "ctxt" line gives the total number of context switches across all CPUs.

The "btime" line gives the time at which the system booted, in seconds since the Unix epoch (January 1, 1970).

The "processes" line gives the number of processes and threads created, which includes (but is not limited to) those created by calls to the fork() and clone() system calls.

The "procs_running" line gives the number of processes currently running on CPUs (Linux 2.5.45 onwards)

The "procs_blocked" line gives the number of processes currently blocked, waiting for I/O to complete (Linux 2.5.45 onwards)

Reference

https://jeongchul.tistory.com/613
https://www.idnt.net/en-US/kb/941772
https://www.kgoettler.com/post/proc-stat/
https://supportcenter.checkpoint.com/supportcenter/portal?eventSubmit_doGoviewsolutiondetails=&solutionid=sk65143
https://tkyoo.tistory.com/26

profile
Backend Developer

0개의 댓글