Next: Secure Programming
Up: The /proc File System
Previous: Drives, Mounts, and File
Two entries in /proc contain useful system statistics.
- The /proc/loadavg file contains information about the system load.
- The first three numbers represent the number of active tasks on the system averaged over the last 1, 5, and 15 minutes.
- The next entry shows the instantaneous current number of runnable tasks; processes that are currently scheduled to run rather than being blocked in a system call and the total number of processes on the system.
- The final entry is the process ID of the process that most recently ran.
- The /proc/uptime file contains the length of time since the system was booted, as well as the amount of time since then that the system has been idle. Both are given as
floating-point values, in seconds.
$ cat /proc/uptime
The following http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/print-uptime.cprogram (see Fig. 7) extracts the uptime and idle time from the system and displays them in friendly units.
Figure 7:
Print the System Uptime and Idle Time.
|
Next: Secure Programming
Up: The /proc File System
Previous: Drives, Mounts, and File
Cem Ozdogan
2007-05-07