Next: Process Information
Up: The /proc File System
Previous: The /proc File System
Contents
- Most of the entries in /proc provide information formatted to be readable by humans.
$ cat /proc/cpuinfo
- The http://siber.cankaya.edu.tr/SystemsProgramming/cfiles/clock-speed.cprogram in Fig. 10.1 shows a simple way to extract a value from the output by reading the file into a buffer and parse it in memory using sscanf. The program includes the function get_cpu_clock_speed that reads from /proc/cpuinfo into memory and extracts the first CPU's clock speed.
Figure 10.1:
Extract CPU Clock Speed from /proc/cpuinfo.
|
Cem Ozdogan
2007-05-16