Performance calculation of CPU in SylixOS
1. Overview
This paper mainly introduces the performance calculation method of CPU in SylixOS.
2. Introduction
BogoMips is a standard in SylixOS to measure the running speed of CPU, but it can only be used to roughly calculate the performance of CPU, which is not very accurate.
The method of CPU performance calculation in SylixOS is located in the kernel file "libsylixos/SylixOS/kernel/interface/CpuPerf.c".
3. Interface and its implementation
The relevant interfaces for calculating the speed of CPU operations are defined in the SylixOS kernel.
3.1 Interface introduction
# include
ULONG API_CpuBogoMips (ULONG ulCPUId, ULONG * pulKInsPerSec)
Function API_CpuBogoMips prototype analysis:
This function returns ERROR_NONE for success and ERROR_CODE for failure.
Parameter ulCPUId is CPU ID
The parameter pulKInsPerSec is the number of instructions executed per second (in thousands of instructions).
3.2 specific implementation process
The speed of computing CPU in SylixOS needs to consider the difference between single-core and multi-core processors. The single-core processor only needs to directly execute a certain number of counting cycles, which can be converted into the number of instructions per second according to the number of tick consumed to execute the counting cycle, while the multi-core processor needs to bind the counting loop thread to a specific CPU to ensure that it runs into the CPU and improve the accuracy of the calculation results. The specific implementation process is shown in figure 3.1.
Figure 3.1 flowchart of CPU performance calculation