I see that you said from C++. In that case, there's Qt Test. Taking the example from the docs:
class MyFirstBenchmark: public QObject
{
Q_OBJECT
private slots:
void myFirstBenchmark()
{
QString string1;
QString string2;
QBENCHMARK {
string1.localeAwareCompare(string2);
}
}
};
You can do this with TestCase
.
TestCase {
id: top
name: "CreateBenchmark"
Button {
id: button
onClicked: doSomeStuff()
}
function benchmark_create_component() {
mouseClick(button);
}
}
RESULT : CreateBenchmark::benchmark_create_component:
0.23 msecs per iteration (total: 60, iterations: 256)
PASS : CreateBenchmark::benchmark_create_component()
You would use the mouseClick()
function to simulate a click on a button.
There's also qmlbench, which was blogged about recently.