2001-11-15 15:30:15

by Sven Heinicke

[permalink] [raw]
Subject: /proc/stat description for proc.txt


I got tired at looking proc_misc.c to see what /proc/stat was
reporting about. So here is my noted patched into proc.txt about the
/proc/stat file. It's a patch off the 2.4.15-pre1 proc.txt, but it
worked fine patching it into 2.4.15-pre4 kernel. Between which I
don't actually think proc.txt has changed.

Sven


--- proc.copy.txt Thu Nov 8 10:36:57 2001
+++ proc.txt Thu Nov 8 13:33:01 2001
@@ -25,6 +25,7 @@
1.5 SCSI info
1.6 Parallel port info in /proc/parport
1.7 TTY info in /proc/tty
+ 1.8 Kernel Statistics in /proc/stat

2 Modifying System Parameters
2.1 /proc/sys/fs - File system data
@@ -223,7 +224,7 @@
rtc Real time clock
scsi SCSI info (see text)
slabinfo Slab pool info
- stat Overall statistics
+ stat Overall statistics (1.8)
swaps Swap space utilization
sys See chapter 2
sysvipc Info of SysVIPC Resources (msg, sem, shm) (2.4)
@@ -566,9 +567,9 @@
1.7 TTY info in /proc/tty
-------------------------

-Information about the available and actually used tty's can be found in the
-directory /proc/tty.You'll find entries for drivers and line disciplines in
-this directory, as shown in Table 1-9.
+Information about the available and actually used tty's can be found
+in the directory /proc/tty. You'll find entries for drivers and line
+disciplines in this directory, as shown in Table 1-9.


Table 1-9: Files in /proc/tty
@@ -595,6 +596,51 @@
/dev/tty /dev/tty 5 0 system:/dev/tty
unknown /dev/tty 4 1-63 console

+
+1.8 Kernel Statistics in /proc/stat
+-----------------------------------
+
+General statistics about what the kernel has been doing is available
+in the /proc stat file. To view the statistics simply;
+
+$ cat /proc/stat
+cpu 58903 1 7337 221340
+cpu0 58903 1 7337 221340
+page 97604 92120
+swap 1 0
+intr 571041 287581 3738 0 0 3 0 2 0 0 0 0 56043 202215 0 21398 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+disk_io: (3,0):(21459,9839,195208,11620,184240)
+ctxt 1719440
+btime 1005238271
+processes 4997
+
+The individual "cpu" entry is will be the same as "cpu0" if you only
+have one CPU on your system. Otherwise the "cpu" entry will be a
+total of all the separate CPU stats. The four numbers following "cpu"
+entries are: user, nice, system and unused usage (I think unused usage
+anyway).
+
+The two numbers following the "page" entry are number of pages going
+in followed by the number of pages going out. Same goes for the
+"swap" entry.
+
+The "intr" entry show the number of interrupts. The first number is
+the total interrupts between all IRQs. The remaining numbers are the
+interrupts for each IRQ in order.
+
+The "disk_io" shows data for each active disk. The above example only
+shows one active disk. The first pair is the major followed by the
+disk number entry. The others are `dk_drive', `dk_drive_rio',
+`dk_drive_rblk', `dk_drive_wio', `dk_drive_wblk' entries for that
+disk. (If I ever figure out what they are i'll describe them
+beter. -Sven)
+
+"ctxt" the the contest switches.
+
+Can't figure what "btime" is.
+
+"processes" is the number of processes that have run since boot. This
+includes forks, don't know if it includes threads.

------------------------------------------------------------------------------
Summary


2001-11-15 19:00:37

by Andreas Dilger

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt

On Nov 15, 2001 10:29 -0500, Sven Heinicke wrote:
> +cpu 58903 1 7337 221340
> +
> +The individual "cpu" entry is will be the same as "cpu0" if you only
> +have one CPU on your system. Otherwise the "cpu" entry will be a
> +total of all the separate CPU stats. The four numbers following "cpu"
> +entries are: user, nice, system and unused usage (I think unused usage
> +anyway).

Units of what? Probably jiffies. Also "unused" is actually better
described as "idle".

> +disk_io: (3,0):(21459,9839,195208,11620,184240)
> +
> +The "disk_io" shows data for each active disk. The above example only
> +shows one active disk. The first pair is the major followed by the
> +disk number entry. The others are `dk_drive', `dk_drive_rio',
> +`dk_drive_rblk', `dk_drive_wio', `dk_drive_wblk' entries for that
> +disk. (If I ever figure out what they are i'll describe them
> +beter. -Sven)

Looks like (in order):
- total number of I/O operations on this drive
- read I/O operations
- read I/O sectors
- write I/O operations
- write I/O sectors

> +btime 1005238271
> +Can't figure what "btime" is.

This appears to be the time in seconds (i.e. unix time = seconds
since Jan 1, 1970), when the system booted. time(0) - btime will
give you uptime in seconds, (as should the sum of all the "cpu"
times / HZ, if you knew what HZ was in userspace).

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

2001-11-15 20:18:45

by Sven Heinicke

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt


Ok, here is the updates patch with Andreas Dilger suggestions. The
patch is off 2.4.15-pre4 proc.txt file.

--- proc-copy.txt Thu Nov 15 15:05:39 2001
+++ proc.txt Thu Nov 15 15:15:04 2001
@@ -25,6 +25,7 @@
1.5 SCSI info
1.6 Parallel port info in /proc/parport
1.7 TTY info in /proc/tty
+ 1.8 Kernel Statistics in /proc/stat

2 Modifying System Parameters
2.1 /proc/sys/fs - File system data
@@ -223,7 +224,7 @@
rtc Real time clock
scsi SCSI info (see text)
slabinfo Slab pool info
- stat Overall statistics
+ stat Overall statistics (1.8)
swaps Swap space utilization
sys See chapter 2
sysvipc Info of SysVIPC Resources (msg, sem, shm) (2.4)
@@ -566,9 +567,9 @@
1.7 TTY info in /proc/tty
-------------------------

-Information about the available and actually used tty's can be found in the
-directory /proc/tty.You'll find entries for drivers and line disciplines in
-this directory, as shown in Table 1-9.
+Information about the available and actually used tty's can be found
+in the directory /proc/tty. You'll find entries for drivers and line
+disciplines in this directory, as shown in Table 1-9.


Table 1-9: Files in /proc/tty
@@ -595,6 +596,53 @@
/dev/tty /dev/tty 5 0 system:/dev/tty
unknown /dev/tty 4 1-63 console

+
+1.8 Kernel Statistics in /proc/stat
+-----------------------------------
+
+General statistics about what the kernel has been doing is available
+in the /proc/stat file. To view the statistics simply;
+
+$ cat /proc/stat
+cpu 58903 1 7337 221340
+cpu0 58903 1 7337 221340
+page 97604 92120
+swap 1 0
+intr 571041 287581 3738 0 0 3 0 2 0 0 0 0 56043 202215 0 21398 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+disk_io: (3,0):(21459,9839,195208,11620,184240)
+ctxt 1719440
+btime 1005238271
+processes 4997
+
+The individual "cpu" entry is will be the same as "cpu0" if you only
+have one CPU on your system. Otherwise the "cpu" entry will be a
+total of all the separate CPU statistics. The four numbers following
+"cpu" entries are: user, nice, system and idle usage. These are
+stored in, I believe, jiffers.
+
+The two numbers following the "page" entry are number of pages going
+in followed by the number of pages going out. Same goes for the
+"swap" entry.
+
+The "intr" entry show the number of interrupts. The first number is
+the total interrupts between all IRQs. The remaining numbers are the
+interrupts for each IRQ in order.
+
+The "disk_io" shows data for each active disk. The above example only
+shows one active disk. The first pair is the major followed by the
+disk number entry. The others are:
+ - total number of I/O operations on this drive
+ - read I/O operations
+ - read I/O sectors
+ - write I/O operations
+ - write I/O sectors
+
+"ctxt" the the contest switches.
+
+The "btime" field the is up time of the system in seconds.
+
+"processes" is the number of processes that have run since boot. This
+includes forks, don't know if it includes threads.

------------------------------------------------------------------------------
Summary

2001-11-15 20:38:38

by Andreas Dilger

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt

On Nov 15, 2001 15:18 -0500, Sven Heinicke wrote:
> +total of all the separate CPU statistics. The four numbers following
> +"cpu" entries are: user, nice, system and idle usage. These are
> +stored in, I believe, jiffers.
They definitely are in ^^^^^^^ units of jiffies.

> +The "btime" field the is up time of the system in seconds.

It's not the uptime, but actually the time in seconds that the system booted.

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/

2001-11-15 20:44:48

by Sven Heinicke

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt


Third times a charm I hope. Patch to 2.4.15-pre4.

--- proc-copy.txt Thu Nov 15 15:05:39 2001
+++ proc.txt Thu Nov 15 15:41:19 2001
@@ -25,6 +25,7 @@
1.5 SCSI info
1.6 Parallel port info in /proc/parport
1.7 TTY info in /proc/tty
+ 1.8 Kernel Statistics in /proc/stat

2 Modifying System Parameters
2.1 /proc/sys/fs - File system data
@@ -223,7 +224,7 @@
rtc Real time clock
scsi SCSI info (see text)
slabinfo Slab pool info
- stat Overall statistics
+ stat Overall statistics (1.8)
swaps Swap space utilization
sys See chapter 2
sysvipc Info of SysVIPC Resources (msg, sem, shm) (2.4)
@@ -566,9 +567,9 @@
1.7 TTY info in /proc/tty
-------------------------

-Information about the available and actually used tty's can be found in the
-directory /proc/tty.You'll find entries for drivers and line disciplines in
-this directory, as shown in Table 1-9.
+Information about the available and actually used tty's can be found
+in the directory /proc/tty. You'll find entries for drivers and line
+disciplines in this directory, as shown in Table 1-9.


Table 1-9: Files in /proc/tty
@@ -595,6 +596,53 @@
/dev/tty /dev/tty 5 0 system:/dev/tty
unknown /dev/tty 4 1-63 console

+
+1.8 Kernel Statistics in /proc/stat
+-----------------------------------
+
+General statistics about what the kernel has been doing is available
+in the /proc/stat file. To view the statistics simply;
+
+$ cat /proc/stat
+cpu 58903 1 7337 221340
+cpu0 58903 1 7337 221340
+page 97604 92120
+swap 1 0
+intr 571041 287581 3738 0 0 3 0 2 0 0 0 0 56043 202215 0 21398 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+disk_io: (3,0):(21459,9839,195208,11620,184240)
+ctxt 1719440
+btime 1005238271
+processes 4997
+
+The individual "cpu" entry is will be the same as "cpu0" if you only
+have one CPU on your system. Otherwise the "cpu" entry will be a
+total of all the separate CPU statistics. The four numbers following
+"cpu" entries are: user, nice, system and idle usage. These are
+stored in jiffies.
+
+The two numbers following the "page" entry are number of pages going
+in followed by the number of pages going out. Same goes for the
+"swap" entry.
+
+The "intr" entry show the number of interrupts. The first number is
+the total interrupts between all IRQs. The remaining numbers are the
+interrupts for each IRQ in order.
+
+The "disk_io" shows data for each active disk. The above example only
+shows one active disk. The first pair is the major followed by the
+disk number entry. The others are:
+ - total number of I/O operations on this drive
+ - read I/O operations
+ - read I/O sectors
+ - write I/O operations
+ - write I/O sectors
+
+"ctxt" the the contest switches.
+
+"btime" is the time the system booted.
+
+"processes" is the number of processes that have run since boot. This
+includes forks, don't know if it includes threads.

------------------------------------------------------------------------------
Summary

2001-11-15 21:01:18

by Andreas Schwab

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt

Sven Heinicke <[email protected]> writes:

|> +The individual "cpu" entry is will be the same as "cpu0" if you only
^^^^^^^^^^
|> +"ctxt" the the contest switches.
^^^^^^^

Some typos.

Andreas.

--
Andreas Schwab "And now for something
[email protected] completely different."
SuSE Labs, SuSE GmbH, Schanz?ckerstr. 10, D-90443 N?rnberg
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5

2001-11-15 21:11:29

by Sven Heinicke

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt


Ok, now with Andreas Schwab, and Andreas Dilger's corrections.

--- proc-copy.txt Thu Nov 15 15:05:39 2001
+++ proc.txt Thu Nov 15 16:08:12 2001
@@ -25,6 +25,7 @@
1.5 SCSI info
1.6 Parallel port info in /proc/parport
1.7 TTY info in /proc/tty
+ 1.8 Kernel Statistics in /proc/stat

2 Modifying System Parameters
2.1 /proc/sys/fs - File system data
@@ -223,7 +224,7 @@
rtc Real time clock
scsi SCSI info (see text)
slabinfo Slab pool info
- stat Overall statistics
+ stat Overall statistics (1.8)
swaps Swap space utilization
sys See chapter 2
sysvipc Info of SysVIPC Resources (msg, sem, shm) (2.4)
@@ -566,9 +567,9 @@
1.7 TTY info in /proc/tty
-------------------------

-Information about the available and actually used tty's can be found in the
-directory /proc/tty.You'll find entries for drivers and line disciplines in
-this directory, as shown in Table 1-9.
+Information about the available and actually used tty's can be found
+in the directory /proc/tty. You'll find entries for drivers and line
+disciplines in this directory, as shown in Table 1-9.


Table 1-9: Files in /proc/tty
@@ -595,6 +596,53 @@
/dev/tty /dev/tty 5 0 system:/dev/tty
unknown /dev/tty 4 1-63 console

+
+1.8 Kernel Statistics in /proc/stat
+-----------------------------------
+
+General statistics about what the kernel has been doing is available
+in the /proc/stat file. To view the statistics simply;
+
+$ cat /proc/stat
+cpu 58903 1 7337 221340
+cpu0 58903 1 7337 221340
+page 97604 92120
+swap 1 0
+intr 571041 287581 3738 0 0 3 0 2 0 0 0 0 56043 202215 0 21398 61 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
+disk_io: (3,0):(21459,9839,195208,11620,184240)
+ctxt 1719440
+btime 1005238271
+processes 4997
+
+The individual "cpu" entry will be the same as "cpu0" if you only have
+one CPU on your system. Otherwise the "cpu" entry will be a total of
+all the separate CPU statistics. The four numbers following "cpu"
+entries are: user, nice, system and idle usage. These are stored in
+jiffies.
+
+The two numbers following the "page" entry are number of pages going
+in followed by the number of pages going out. Same goes for the
+"swap" entry.
+
+The "intr" entry show the number of interrupts. The first number is
+the total interrupts between all IRQs. The remaining numbers are the
+interrupts for each IRQ in order.
+
+The "disk_io" shows data for each active disk. The above example only
+shows one active disk. The first pair is the major followed by the
+disk number entry. The others are:
+ - total number of I/O operations on this drive
+ - read I/O operations
+ - read I/O sectors
+ - write I/O operations
+ - write I/O sectors
+
+"ctxt" the contest switches.
+
+"btime" is the time the system booted.
+
+"processes" is the number of processes that have run since boot. This
+includes forks, don't know if it includes threads.

------------------------------------------------------------------------------
Summary

2001-11-15 21:51:49

by Marius Gedminas

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt

On Thu, Nov 15, 2001 at 04:10:54PM -0500, Sven Heinicke wrote:
> +"ctxt" the contest switches.

The number of _context_ switches since boot, IIUC.

> +"processes" is the number of processes that have run since boot. This
> +includes forks, don't know if it includes threads.

It counts the number of successful fork(), vfork() and clone() system
calls (and other in-kernel calls of do_fork(), which are, e.g. used to
create idle tasks for all CPUs on SMP systems). So, yes, it does
include (kernel level) threads.

(The above is obtained from several greps on 2.4.12 source tree)

Marius Gedminas
--
main(k){float i,j,r,x,y=-16;while(puts(""),y++<15)for(x
=0;x++<84;putchar(" .:-;!/>)|&IH%*#"[k&15]))for(i=k=r=0;
j=r*r-i*i-2+x/25,i=2*r*i+y/10,j*j+i*i<11&&k++<111;r=j);}
/* Mandelbrot in ASCII. */

2001-11-16 16:51:33

by Anthony DeRobertis

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt

On Nov 15, 2001 10:29 -0500, Sven Heinicke wrote:
> +cpu 58903 1 7337 221340
> +
> +The individual "cpu" entry is will be the same as "cpu0" if you only
> +have one CPU on your system. Otherwise the "cpu" entry will be a
> +total of all the separate CPU stats.

Isn't the first sentence redundant? Also, the second one is a
little confusing because "Otherwise..." implies a difference,
when there is none.

2001-11-20 22:57:49

by Jorge Nerin

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt

Sven Heinicke wrote:

> I got tired at looking proc_misc.c to see what /proc/stat was
> reporting about. So here is my noted patched into proc.txt about the
> /proc/stat file. It's a patch off the 2.4.15-pre1 proc.txt, but it
> worked fine patching it into 2.4.15-pre4 kernel. Between which I
> don't actually think proc.txt has changed.
>
> Sven
>
> [snip]

> Summary
> -
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to [email protected]
> More majordomo info at http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/
>
>

Hey I wrote the last update to this file about exactly one year ago, and
I wrote it for the same reasons as you.

I needed some info about some files and fields in the proc tree, and the
responses was 1) read proc.txt (seriously out of date) and 2) look at
the source Luke.

So I also got tired of seeking & greping around the code and wrote a
small update, nice to see someone updated it again.

P.D. It should be updated by the people who updates the interface, at
least minimally, the name and meaning of the fields or where to look.

--
Jorge Nerin
<[email protected]>

2001-11-21 15:47:57

by Sven Heinicke

[permalink] [raw]
Subject: Re: /proc/stat description for proc.txt


Yea, well, I didn't get any message about my proc.txt patch going into
the kernel. So it's back to the source I guess. :(

Sven

Jorge Nerin writes:
> Sven Heinicke wrote:
>
> > I got tired at looking proc_misc.c to see what /proc/stat was
> > reporting about. So here is my noted patched into proc.txt about the
> > /proc/stat file. It's a patch off the 2.4.15-pre1 proc.txt, but it
> > worked fine patching it into 2.4.15-pre4 kernel. Between which I
> > don't actually think proc.txt has changed.
> >
> > Sven
> >
> > [snip]
>
> > Summary
> > -
> > To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> > the body of a message to [email protected]
> > More majordomo info at http://vger.kernel.org/majordomo-info.html
> > Please read the FAQ at http://www.tux.org/lkml/
> >
> >
>
> Hey I wrote the last update to this file about exactly one year ago, and
> I wrote it for the same reasons as you.
>
> I needed some info about some files and fields in the proc tree, and the
> responses was 1) read proc.txt (seriously out of date) and 2) look at
> the source Luke.
>
> So I also got tired of seeking & greping around the code and wrote a
> small update, nice to see someone updated it again.
>
> P.D. It should be updated by the people who updates the interface, at
> least minimally, the name and meaning of the fields or where to look.
>
> --
> Jorge Nerin
> <[email protected]>
>