Check CPU cat /proc/cpuinfo

The Raspberry Pi has a lot of system information available like details about the CPU, the current temperature of the processor, the amount of memory and so on. Not all of the information is available in one place; however, if you know where to look, you can discover quite a lot of interesting data about your Pi.

Besides the “standard” system resource tools like “ps“, “df“, “top” and other useful commands like “htop”, “iotop” and “glances”, system information can be found under the “/proc” filesystem. One of the most useful is the “cpuinfo” file, which contains data on a system’s CPU. To see it type:

cat /proc/cpuinfo

raspberry-pi-cat-proc-cpuinfo-700px

The output tells us three things about this Raspberry Pi: It has a processor based on the ARM architecture (rather than Intel as in Windows PCs and Macs), the processor uses the ARMv6 instruction set, and that the processor is the BCM2708, which we know is a processor from Broadcom. The ARMv6 instruction set is one of the older ARM designs. Most modern smartphones and tablets use the ARMv7 architecture, and increasingly the new 64-bit ARMv8 instruction set is becoming more mainstream.

Other files that are worth looking at in the “/proc” filesystem include “/proc/meminfo”, “/proc/partitions” and “/proc/version.” Each can be examined using the “cat” command.

The information found under “/proc” is available on all Linux systems; however, the Raspberry Pi also has a special command available which displays information that is specific to the Raspberry Pi board. The “vcgencmd” tool can access a lot of Raspberry Pi specific information including clock frequencies, various voltages, the CPU temperature, and which hardware codecs are enabled.

Starting with the CPU core temperature, type:

vcgencmd measure_temp

The output is a single line reporting the temperature:

temp=50.8'C

This number is important for those who overclock their Pi’s processor or who have built projects around the Raspberry Pi with limited airflow over the processor.

Talking of overclocking, to see the current CPU frequency along with the minimum and maximum frequencies use:

cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq
cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq

raspberry-pi-clock-freqs

The numbers output are in kilohertz, so 950000 is 950MHz.

Other clock speeds can also be discovered using “vcgencmd measure_clock CLOCKNAME” where CLOCKNAME is one of h264, isp, v3d, uart, pwm, emmc, pixel, vec, hdmi, or dpi. For example:

vcgencmd measure_clock arm

The output is in Hertz, so 700000000 is 700MHz.

frequency(45)=700000000

You can use the following shell script to list all the clock speeds:

for src in arm core h264 isp v3d uart pwm emmc pixel vec hdmi dpi ; do \
echo -e "$src:\t$(vcgencmd measure_clock $src)" ; \
done

Another “vcgencmd” system command that you might find useful is “vcgencmd measure_volts” to find the internal voltages for core, sdram_c, sdram_i, and sdram_p. For example:

vcgencmd measure_volts core

The output will look something like this:

volt=1.20V

The following shell commands will display all the voltages:

for id in core sdram_c sdram_i sdram_p ; do \
echo -e "$id:\t$(vcgencmd measure_volts $id)" ; \
done

To see which hardware codecs have been enabled, use “vcgencmd codec_enabled CODECNAME” where CODECNAME is one of H264, MPG2, WVC1, MPG4, MJPG, or WMV9. For example:

vcgencmd codec_enabled H264

To save time repeating the command for every codec you can use this simple piece of shell script.

for codec in H264 MPG2 WVC1 MPG4 MJPG WMV9 ; do \
echo -e "$codec:\t$(vcgencmd codec_enabled $codec)" ; \
done

To see how the memory is split between the CPU and the GPU use:

raspberry-pi-vcgencmd-get-mem

Finally, to see how much free memory is available to the system use:

free -o -h

If you have any questions about vcgencmd or any of the other system tools mentioned, please leave a comment below and we will see if we can help.

ประเภทเนื้อหาของ article
Raspberry Pi Zero
Rating
No votes yet