UnixBench: A Detailed Implementation

Dhrystone 2 Using Register Variables

Dhrystone is a synthetic computing benchmark program that primarily tests the integer performance of a CPU. The corresponding floating-point number test is Double-Precision Whetstone.

Double-Precision Whetstone

In addition to the tests showing the CPU performance in integer operations, whets.c demonstrates the floating-point number computation performance, which features much higher code quality and intelligibility.

  1. It requires an appropriate parameter. How is the operation obtained? In this operation set, when the input parameter (xtra) increases, the computation time consumed gradually increases or decreases. When the time consumed exceeds two seconds, the parameter stops increasing.

Execl Throughput

In addition to the two complex operations described above, other UnixBench operations are relatively simple. In Execl, it is actually a recursive call of the execl function. The execution file compiled by execl.c is a binary file of execl. When the execl function is executed, these parameters are recorded: start time, number of executions, and time consumed (generally 10 seconds). The concept is rather clever: The total number of executions is output when the time consumed exceeds 10 seconds, based on which the score is calculated according to the scoring rule.

File Copy

This test mainly checks the write and read functions and takes 30 seconds. Its implementation is simple. First, the code writes a file for two seconds (cyclically) and reads the file for data for two seconds. The data obtained is then written to another file cyclically. In this way, the code obtains the number of read and write operations in 30 seconds. The parameters are used to test the performance with different block sizes. To test disks, FIO is recommended.

Pipe Throughput

This test opens a pipeline, writes 512 bytes to the pipeline, and then reads the data from the pipeline. The test calculates the number of read and write operations in 10 seconds.

Pipe-based Context Switching

This test opens two pipelines and enables two processes. One process writes data to pipeline 1 and reads data from pipeline 2. The other process writes data to pipeline 2 and reads data from pipeline 2. Each time a process completes one read and write cycle, the result increases by 1. Interestingly, the test result is much better if the two processes are performed on the same CPU rather than on different CPUs. The following article in this series will provide a detailed analysis of this issue.

Process Creation

This test repeatedly calls the fork function to create a process and then immediately exits the process. Each time the operation cycle is completed, the result increases by 1.

Shell Scripts

This test uses the fork function to create a process and execute a script repeatedly. Each time the script is executed successfully, the result increases by 1. Shell Scripts (1 concurrent) indicates that the pgms/multi.sh parameter input to the script is 1. Shell Scripts (8 concurrent) indicates that the pgms/multi.sh parameter input to the script is 8 and eight subtasks are executed concurrently.

System Call Overhead

This test calculates the overhead for entering and exiting the operating system. Each time entry and exit is performed, the result increases by 1. The test calculates the number of executions within 10 seconds. The execution is based on the fork child process. Each time the waitpid function is exited, the result increases by 1.

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Alibaba Cloud

Alibaba Cloud

Follow me to keep abreast with the latest technology news, industry insights, and developer trends. Alibaba Cloud website:https://www.alibabacloud.com