Linux CPU Performance Test
This document provides an introduction to CPU performance testing tools in BCC Linux systems. Using CentOS 7.6 as an example, the main details are outlined below (test results should be used for reference and analyzed based on the server's specific workload and setup).
-
Performance Metrics
Generally, the following metrics are used to measure CPU performance:- Dhrystone 2 using register variables
- Double-Precision Whetstone
- Test tools
UnixBench is an open-source tool designed to evaluate the basic performance of Unix systems, often used to test VPS performance. The tool assesses various system performance metrics and compares each result against a baseline value to produce an index. These indices are combined to calculate a total score. The test results depend not only on hardware but also on the operating system, development libraries, and compilers. The execution time is typically 10-30 minutes.
UnixBench also supports testing on multi-CPU systems. By default, it runs two test cases: one for single-process performance and another for multi-process performance.
- Tool Installation
- Download the package, unzip it, and navigate to the unixbench directory, with unixbench-5.1.3 as an example.
1$ wget https://soft.laozuo.org/scripts/UnixBench5.1.3.tgz
2$ tar -zxvf UnixBench5.1.3.tgz
3$ cd UnixBench
- make compilation
1$ make
If errors occur during "make," install the necessary dependency packages as per the reference guide.
1///1.make: gcc: Command not found
2make: *** [pgms/arithoh] Error 127
3 If a gcc error occurs, we need to install the gcc dependency package
4///
5$ yum install gcc
6 ///2.Error: Please install /usr/bin/time prompts an error. The solution is as follows:
7$ yum install time
8 ///3.If bash appears: make: command not found issue
9$ yum -y install gcc automake autoconf libtool make
- Execute ./Run to begin benchmarking
1$ ./Run
If errors occur during execution, install the required dependency packages as per the reference guide.
1///3.Can't locate Time/HiRes.pm
2 Sometimes such errors may occur when running ./Run
3Can't locate Time/HiRes.pm in @INC (@INC contains: /usr/local/lib64/perl5 /usr/local/share/perl5 /usr/lib64/perl5/vendor_perl /usr/share/perl5/vendor_perl /usr/lib64/perl5 /usr/share/perl5 .) at ./Run line 6.
4BEGIN failed--compilation aborted at ./Run line 6.
5 The solution is also simple, requiring only the installation of the component
6///
7yum install perl-Time-HiRes
8 //After running the installation, we can then run ./Run.
- Parameter description
During testing, each item will be followed by numbers 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, indicating that 10 groups of tests have been conducted. Some of the contents and explanations during testing are as follows:
| Test item | Project description |
|---|---|
| Dhrystone 2 using register variables | Test string handling. This test focuses on string processing without floating-point operations, and the results are greatly affected by hardware design and software optimization |
| Double-Precision Whetstone | Test the speed and efficiency of floating-point operations |
| Execl Throughput | This test examines the count of execl system calls that can be executed per second |
| File Copy 1024 bufsize 2000 maxblocks | Test the data transmission rate between files |
| File Copy 256 bufsize 500 maxblocks | Test the data transmission rate between files |
| File Read 4096 bufsize 8000 maxblocks | Test the data transmission rate between files |
| Pipe-based Context Switching | Test the count two processes exchange an incrementing integer over a pipe per second |
| Pipe Throughput | Count a process can write 512 bytes of data to a pipe and read it back within one second |
| Process Creation | Test the count a process can create a child process and then retract the child process (the child process must exit immediately) |
| Shell Scripts (8 concurrent) | Test the count a process can concurrently start n copies of a shell script in one second, where n is typically 1, 2, 4, 8 |
| System Call Overhead | Test the cost of entering and exiting the OS kernel, i.e., the cost of a single system call |
