diff options
author | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-22 14:46:40 +1000 |
---|---|---|
committer | Rhys Weatherley <rhys.weatherley@nokia.com> | 2010-02-22 14:46:40 +1000 |
commit | c36ce51b224b5e10720373ba5af98ac6b4ed7b44 (patch) | |
tree | 294a1c5f9b13ab9ec470d7744253ad9c7740c8b8 /tests/auto | |
parent | 4ea183d215d575ae96f8f437334b3f07b9719e45 (diff) |
Add some event profiling tests.
Diffstat (limited to 'tests/auto')
-rw-r--r-- | tests/auto/qcl/tst_qcl.cpp | 29 |
1 files changed, 29 insertions, 0 deletions
diff --git a/tests/auto/qcl/tst_qcl.cpp b/tests/auto/qcl/tst_qcl.cpp index b03b933..b61e9f8 100644 --- a/tests/auto/qcl/tst_qcl.cpp +++ b/tests/auto/qcl/tst_qcl.cpp @@ -59,6 +59,7 @@ private slots: void buildProgram(); void argumentPassing(); void vectorBuffer(); + void eventProfiling(); private: QCLContext context; @@ -225,6 +226,34 @@ void tst_QCL::vectorBuffer() QVERIFY(!vector1.isMapped()); } +void tst_QCL::eventProfiling() +{ + QCLCommandQueue queue = context.defaultCommandQueue(); + QVERIFY(!queue.isProfilingEnabled()); + queue.setProfilingEnabled(true); + QVERIFY(queue.isProfilingEnabled()); + + QCLVector<float> vector1 = context.createVector<float>(20000); + for (int index = 0; index < vector1.size(); ++index) + vector1[index] = float(index); + vector1.unmap(); + + QCLKernel addToVector = program.createKernel("addToVector"); + addToVector.setGlobalWorkSize(vector1.size()); + QCLEvent event = addToVector(vector1, 42.0f); + + event.waitForFinished(); + + // The following tests assume that device time is monotonicly increasing. + QVERIFY(event.finishTime() != 0); + QVERIFY(event.submitTime() >= event.queueTime()); + QVERIFY(event.runTime() >= event.submitTime()); + QVERIFY(event.finishTime() >= event.runTime()); + + queue.setProfilingEnabled(false); + QVERIFY(!queue.isProfilingEnabled()); +} + QTEST_MAIN(tst_QCL) #include "tst_qcl.moc" |