From 142fc02ec592d203bb4ad660163c3204bd9f50c8 Mon Sep 17 00:00:00 2001 From: ZappoMan Date: Wed, 25 Jun 2014 11:31:36 -0700 Subject: [PATCH] octree tests tweaks Conflicts: tests/octree/src/ModelTests.cpp tests/octree/src/main.cpp --- tests/octree/src/ModelTests.cpp | 17 ++++++++++++++--- tests/octree/src/main.cpp | 4 ++-- 2 files changed, 16 insertions(+), 5 deletions(-) diff --git a/tests/octree/src/ModelTests.cpp b/tests/octree/src/ModelTests.cpp index 17c940f902..650ad40733 100644 --- a/tests/octree/src/ModelTests.cpp +++ b/tests/octree/src/ModelTests.cpp @@ -26,7 +26,7 @@ void ModelTests::modelTreeTests(bool verbose) { - bool extraVerbose = false; + bool extraVerbose = true; int testsTaken = 0; int testsPassed = 0; int testsFailed = 0; @@ -240,9 +240,10 @@ void ModelTests::modelTreeTests(bool verbose) { { // seed the random number generator so that our tests are reproducible srand(0xFEEDBEEF); + ModelTree tree; testsTaken++; - const int TEST_ITERATIONS = 10000; + const int TEST_ITERATIONS = 10; QString testName = "Performance - add model to tree " + QString::number(TEST_ITERATIONS) + " times"; if (verbose) { qDebug() << "Test" << testsTaken <<":" << qPrintable(testName); @@ -266,11 +267,21 @@ void ModelTests::modelTreeTests(bool verbose) { properties.setRadius(halfMeter); properties.setModelURL("https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/theater.fbx"); + if (extraVerbose) { + qDebug() << "iteration:" << i + << "ading model at x/y/z=" << randomX << "," << randomY << "," << randomZ; + qDebug() << "before:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount(); + } + quint64 startAdd = usecTimestampNow(); tree.addModel(modelID, properties); quint64 endAdd = usecTimestampNow(); totalElapsedAdd += (endAdd - startAdd); + if (extraVerbose) { + qDebug() << "after:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount(); + } + quint64 startFind = usecTimestampNow(); float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units const ModelItem* foundModelByRadius = tree.findClosestModel(randomPositionInTreeUnits, targetRadius); @@ -285,7 +296,7 @@ void ModelTests::modelTreeTests(bool verbose) { // Every 1000th test, show the size of the tree... if (verbose && (i % 1000 == 0)) { - qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount(); + qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount(); } bool passed = foundModelByRadius && foundModelByID && (foundModelByRadius == foundModelByID); diff --git a/tests/octree/src/main.cpp b/tests/octree/src/main.cpp index 44ec485a52..ff6e5bcbf2 100644 --- a/tests/octree/src/main.cpp +++ b/tests/octree/src/main.cpp @@ -17,8 +17,8 @@ int main(int argc, const char* argv[]) { const char* VERBOSE = "--verbose"; bool verbose = cmdOptionExists(argc, argv, VERBOSE); qDebug() << "OctreeTests::runAllTests()"; - OctreeTests::runAllTests(verbose); - AABoxCubeTests::runAllTests(verbose); + //OctreeTests::runAllTests(verbose); + //AABoxCubeTests::runAllTests(verbose); ModelTests::runAllTests(verbose); return 0; }