summaryrefslogtreecommitdiffstats
path: root/tests
diff options
context:
space:
mode:
authorFrantisek Vacek <fvacek@rim.com>2012-10-11 13:15:47 +0200
committerThe Qt Project <gerrit-noreply@qt-project.org>2012-10-12 02:19:36 +0200
commit379ecbe8a7353d8fc6e9f1608c9c62f0ed27c891 (patch)
tree0e9e478226270e9ebb494d25cbbe34b6d5614d76 /tests
parentee447020dbecef821b73d7d2981d7c8859c9a28b (diff)
QDeclarativeTrace patch for a custom trace instance
Needed for the BB10 Cascades profiling. There are more reasons for introducing this patch: 1) Cascades do not use QtGui library for QML rendering. It has its own paint engine with client-server architecture. Profiler traces are sent asynchronously from non Qt renderer thread to the Qt client. The QPerformanceTimer has to be patched too, cause we need to know time difference between tracing zero time and some time in past, see: qint64 elapsedToAbsoluteTime(qint64 absoluteMonotonicTimeNs) const 2) Since we need more sophisticated trace engine in cascades, this patch allows explicitly assign custom class derived from QDeclaraqtiveDebugtrace to the trace framework. If no custom instance is assigned, the default QDeclarativeDebugTrace instance is created implicitly on first trace request. Using custom trace instance which is not part of Qt (it is part of libbbcascades) allows us to implement all Cascades trace special needs in libbbcascades and not to carry Qt with the platform specific code. 3) The NO_CUSTOM_DECLARATIVE_DEBUG_TRACE_INSTANCE macro is introduced to allow custom trace engine only on the bleckberry platform, see declarative.pro. If this macro is defined Qt compiles from its original code. 4) Possibility of custom QDeclaraqtiveDebugTrace instance might be usable for other projects which needs to extends somehow default Qt trace functionality. 5) Patch is not intended to be applied to Qt Quick 2, since declarative debugging infrastructure is changed there. (cherry picked from commit f13b52f25c1e0bc26dcf3ea304b3495f7d5cd370) Change-Id: I199211c1de66e930e252e8c033503d7f4940565f Reviewed-by: Christiaan Janssen <christiaan.janssen@digia.com>
Diffstat (limited to 'tests')
-rw-r--r--tests/auto/declarative/declarative.pro3
-rw-r--r--tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp18
2 files changed, 17 insertions, 4 deletions
diff --git a/tests/auto/declarative/declarative.pro b/tests/auto/declarative/declarative.pro
index c9486b0524..9cd2aa0eec 100644
--- a/tests/auto/declarative/declarative.pro
+++ b/tests/auto/declarative/declarative.pro
@@ -77,7 +77,8 @@ contains(QT_CONFIG, private_tests) {
qdeclarativevisualdatamodel \
qdeclarativeworkerscript \
qdeclarativexmllistmodel \
- qpacketprotocol
+ qpacketprotocol \
+ qperformancetimer
}
contains(QT_CONFIG, opengl): SUBDIRS += qmlshadersplugin
diff --git a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp
index 28dd95bae1..d253f9f73c 100644
--- a/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp
+++ b/tests/auto/declarative/qperformancetimer/tst_qperformancetimer.cpp
@@ -58,9 +58,21 @@ void tst_qperformancetimer::units()
{
QPerformanceTimer timer;
timer.start();
- QTest::qWait(300);
- qint64 elapsed = timer.elapsed();
- QVERIFY(elapsed > 300000000 && elapsed < 310000000);
+ {
+ QTest::qWait(300);
+ qint64 elapsed = timer.elapsed();
+ QVERIFY(elapsed > 300000000 && elapsed < 310000000);
+ }
+ {
+ timer.start();
+ qint64 monotonic_start = -timer.elapsedToAbsoluteTime(0);
+ qint64 wait_ms = 300;
+ QTest::qWait(wait_ms);
+ qint64 elapsed1 = timer.elapsed();
+ qint64 elapsed2 = timer.elapsedToAbsoluteTime(monotonic_start + elapsed1);
+ qint64 diff = elapsed1 - elapsed2;
+ QVERIFY(diff == 0);
+ }
}
QTEST_MAIN(tst_qperformancetimer)