Vous êtes sur la page 1sur 5

Benchmark Program for CPU

Short description
To make a benchmark for CPU means to run a set of programs or other
operations in order to assess the relative performance of the CPU, normally by
running a number of standard tests and trials against it.
It is always important to run many iterations of a benchmark. Timings will
change and an average of all iterations should be used to provide a more
accurate picture for comparisons.

Tests for benchmark


The CPU is very complex and testing its limit cannot be done in only 1 test.
It has multiple types of operations and instructions on which we can apply
different tests. Each one will test a unique part of the CPU :
1.
2.
3.
4.
5.

Integer maths test


Prime number test
Floating point math test
String sorting test
Single core test

1. Integer maths test


The Integer Math Test aims to measure how fast the CPU can perform
mathematical integer operations. This is a basic operation in all computer
software and provides a good indication of 'raw' CPU throughput. The test uses a
large sets of random 32-bit and 64-bit integers and adds, subtracts, multiplies
and divides these numbers.

2. Prime Numbers
The Prime Number Test aims to test how fast the CPU can search for Prime
numbers, reported as operations per second. A prime number is a number that
can only be divided by itself and 1. For example, 1, 2, 3, 5, 7, 11 etc. This
algorithm uses loops and CPU operations that are common in computer software,
the most intensive being multiplication and modulo operations. All operations are
performed using 64-bit integers. The specific formula used for this test is
the Sieve of Atkin with a limit of 32 million.

3. Floating point math test


The Floating Point Math Test performs the same operations as the Integer
Maths Test however with floating point numbers. These kinds of numbers are
handled quite differently in the CPU compared to integer numbers as well as
being quite commonly used, therefore they are tested separately.

4. String sorting test


The String Sorting Test uses the quicksort algorithm to see how fast the CPU
can sort strings. A very common task found in many applications.

5. Single core test


The single core test only uses one CPU core and rates the computers
performance under these conditions. Many applications still only use one core so
this is an important metric; additionally many modern CPUs will automatically
overclock themselves when only a single core is in use to boost performance in
these scenarios. The single core test is an aggregate of the floating point, string
sorting and data compression tests.

Final result and test results


Every one of the test will have a result. It will depend on the time that it
needed to execute multiple iterations of each test. The data for the tests will be
supplied in a matter that every CPU can run them so the program can then make
a statistic on the CPUs that it ran. The result will be in points, the higher the
better, depending on the calculated value of each test. For a lesser time it will get
greater points and then an average will be the final result.
The final formula takes the average between all the test results and use it in
the next function :

Final result = 1/average * constant


The constant is used to get an integer as final result, so it will be a multiple of
10 and a high number to cover the average, so it will be 10000. The higher the
final result, the better.
The CPU has also multiple sensors which can be accessed by software. The
application will also show this information together with the name of the CPU
which will serve as ID when is saved the result after the benchmarks tests are
done.

Algorithms
1. Quicksort for string sorting test
Quicksort is a divide and conquer algorithm. Quicksort first divides a large array into two smaller
sub-arrays: the low elements and the high elements. Quicksort can then recursively sort the subarrays.
The steps are:
1. Pick an element, called a pivot, from the array.
2. Partitioning: reorder the array so that all elements with values less than the pivot come
before the pivot, while all elements with values greater than the pivot come after it (equal
values can go either way). After this partitioning, the pivot is in its final position.
3. Recursively apply the above steps to the sub-array of elements with smaller values and
separately to the sub-array of elements with greater values.

2. Sieve of Atkin for prime numbers


Sieve of Atkin is a modern algorithm for finding all prime numbers up to a specified
integer. Compared with the ancient sieve of Eratosthenes, which marks off multiples of primes, it
does some preliminary work and then marks off multiples of squares of primes, thus achieving a
better theoretical asymptotic complexity.
1. Create a results list, filled with 2, 3, and 5.
2. Create a sieve list with an entry for each positive integer; all entries of this list should
initially be marked non prime (composite).
3. For each entry number n in the sieve list, with modulo-sixty remainder r :
a. If r is 1, 13, 17, 29, 37, 41, 49, or 53, flip the entry for each possible solution
to 4x2 + y2 = n.
b. If r is 7, 19, 31, or 43, flip the entry for each possible solution to 3x2 + y2 = n.
c. If r is 11, 23, 47, or 59, flip the entry for each possible solution
to 3x2 y2 = n when x > y.
d. If r is something else, ignore it completely.
4. Start with the lowest number in the sieve list.

5. Take the next number in the sieve list still marked prime.
6. Include the number in the results list.
7. Square the number and mark all multiples of that square as non prime. Note that the
multiples that can be factored by 2, 3, or 5 need not be marked, as these will be ignored
in the final enumeration of primes.
8. Repeat steps four through seven.

Diagrams
1. Use case diagram

2. Class diagram

Reference
http://www.embedded.com/design/other/4212735/CoreMark--A-realistic-way-tobenchmark-CPU-performance

https://en.wikipedia.org/wiki/Streaming_SIMD_Extensions
https://en.wikipedia.org/wiki/Quicksort
https://en.wikipedia.org/wiki/Sieve_of_Atkin

Vous aimerez peut-être aussi