06 View information
Most of the content introduced in this chapter is not only applicable to the board, but also to the Ubuntu system in the development host. Please try to execute related commands on both platforms to view the information and compare the differences.
1 A preliminary exploration of the /proc directory
Linux does not provide a task manager like Windows, but it records system operation information in files under the /proc directory. Users can obtain corresponding system information by accessing files in this directory.
Please execute the following command in the terminal of the board to view the contents of the /proc directory:
Execute the following command in the terminal of the board: ls /proc

The information contained in each file in this directory is shown in the following table.
Table/proc file structure
file name | effect |
---|---|
pid* | Usually a number, indicating the PID number of the process. Each running process in the system has a corresponding directory (such as /proc/1234), which is used to record all information about the process. The operating system regards each application as a process. |
self | Soft link, pointing to the directory of the current process. You /proc/self/can directly obtain the current process information by accessing it without manually querying the PID. |
thread-self | Soft link, pointing to the current thread. Accessing this file is equivalent to accessing 当前进程PID/task/当前线程TIDthe content of . A process can contain multiple threads, and the threads jointly support the operation of the process. |
version | Record the currently running kernel version, which can uname –rbe viewed through the command. |
cpuinfo | Record the configuration information of the CPU in the system, such as the provider, model, number of cores, frequency, etc. |
modules | Records the kernel module information currently loaded by the system. |
meminfo | Records system memory usage (such as free/used memory). freeThe command obtains data by reading this file. |
filesystems | Records the file system types supported by the kernel. If no file system is specified when mounting a device, mountthe types listed in this file will be tried (excluding nodevfile systems marked with ). |
By accessing the contents of the /proc folder, we can get the system information we want.
2 View CPU information
The /proc/cpuinfo file stores CPU information and can be viewed using the following command:
cat /proc/cpuinfo

3 Check the kernel version
The /proc/version file stores the kernel version information, which we can obtain through the following command.
cat /proc/version

From the above picture we can see that the currently used kernel version is 6.1.99.
You can also get it through the following command:
uname -a
4 View memory information
The kernel records memory usage in the /proc/meminfo file. We can understand our memory usage by reading the contents of this file:
The following is the case with 2GB of memory
cat /proc/meminfo

In actual applications, we generally do not read the contents of the file directly, but use the following command to obtain relevant information about the memory.
Use the free command to view the system's memory size:
free

5 Check the memory capacity
The /proc/partitions file contains the partition information of the memory. You can check the partition information to understand the capacity of the onboard FLASH memory.
You can use the following command to view:
cat /proc/partitions
The following figure shows the command output information using a 32GB eMMC board.

The data blocks starting with mmcblk belong to the eMMC memory.
6 Check task progress
There are many folders named with numbers under the /proc folder. These folders are used to record the status of the currently running processes. The file names are their pid numbers. Each process corresponds to a pid number for identification. The contents contained in these process folders are basically the same. Use the ls command to view the contents of the folder with pid 1, as shown in the figure below. Among them, fd records the file description used by the current process, mountinfo records the mount information, and mem records the memory usage of the process.
ls /proc/1

In addition to the above method, the top command is also commonly used. The function of this command is similar to the Windows Task Manager. The execution effect is shown in the figure above. This command can update the usage of each process in real time. Press the "q" key or "Ctrl + C" to exit the command.
top

7 View supported file systems
/proc/filesystems can be used to view the file system types supported by the kernel, as shown in the figure above. In the figure, some file systems are preceded by the "nodev" sign, indicating that these file systems do not need to mount block devices, such as network file systems nfs/nfs4, pseudo file systems sysfs, etc.
cat /proc/filesystems

8 Check the current CPU frequency
In addition to the /proc directory, you can also view some system-related information in the /sys directory. For example, the file /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq contains the current frequency information of CPU0. If the system has this file, you can output its content to view it:
cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq

As shown in the output in the figure above, it means that the current main frequency of CPU0 is 408MHz.
The CPU of LubanCat-RK3562/RK3566/RK3568 series boards has the function of frequency modulation. When your load is low, it will automatically reduce the frequency to save energy. When a high load is required, it will automatically increase the frequency to improve performance.
ls -g /sys/devices/system/cpu/cpu0/cpufreq/
