Creating a Benchmark
To create a benchmark, follow the instructions for crating a test and then add a QBENCHMARK macro to the test function that you want to benchmark.
class MyFirstBenchmark: public QObject
{
Q_OBJECT;
private slots:
void myFirstBenchmark()
{
QString string1;
QString string2;
QBENCHMARK
{
string1.localeAwareCompare(string2);
}
}
};
The code insde the QBENCHMARK macro will be measured, and possibly also repeated several times in order to get an accurate measurement. This depends on the selected measurement back-end. Several back-ends are available an can be selected on the command line.