L
L
Lockal2011-05-29 15:22:12
Software testing
Lockal, 2011-05-29 15:22:12

Looking for a C++ Code Performance Testing Library?

There is a program for the implementation of the functionality of which there are many algorithms with many parameters. All algorithms work in a single-threaded environment. It is necessary to evaluate the performance of each of them.
Here it is necessary to remember that each environment has its own time measurement methods: somewhere it is QueryPerformanceFrequency/GetSystemTime, somewhere it is clock_gettime/gettimeofday/boost::timer/clock. On some platforms , rdtsc / HPET works . For each case of these functions, the wheel is reinvented.
Unit test syntax expected:

TEST(DecompessTest, 100, 10) {
    CASE (Compressor1) {
        decompress(data1, TYPE_ONE);
    }

    CASE (Compressor2) {
        decompress(data2, TYPE_TWO);
    }
}

After running, each CASE test is run 1000 times, with the time being measured for every hundred runs. At the end, the arithmetic mean of the execution time of each CASE and the standard deviation are determined and displayed on the standard output stream.
DecompessTest:
Compressor1: 52100 ns (±150 ns)
Compressor2: 67500 ns (±205 ns)
Ordinary profilers are not interested in this case: there is no task of finding a weak link in the program by controlling the execution time of everything at all levels of nesting. We are only interested in the average execution time of a section with a standard deviation, on an assembly with full optimization without debugging symbols.
Is there any cross-platform out-of-the-box solution to implement the above?

Answer the question

In order to leave comments, you need to log in

2 answer(s)
D
Daminion, 2011-05-30
@Daminion

Maybe DTrace will work?

L
Lockal, 2011-06-13
@Lockal

And the casket just opened! Found the most complete answer to the question: QBENCHMARK from the Qt testlib.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question