mirror of
https://github.com/overte-org/overte.git
synced 2025-08-09 19:52:26 +02:00
added more timing details to model tests
Conflicts: tests/octree/src/ModelTests.cpp
This commit is contained in:
parent
f440227322
commit
47c0e2266f
1 changed files with 29 additions and 23 deletions
|
@ -26,6 +26,7 @@
|
||||||
|
|
||||||
|
|
||||||
void ModelTests::modelTreeTests(bool verbose) {
|
void ModelTests::modelTreeTests(bool verbose) {
|
||||||
|
bool extraVerbose = false;
|
||||||
int testsTaken = 0;
|
int testsTaken = 0;
|
||||||
int testsPassed = 0;
|
int testsPassed = 0;
|
||||||
int testsFailed = 0;
|
int testsFailed = 0;
|
||||||
|
@ -245,7 +246,8 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
}
|
}
|
||||||
|
|
||||||
int iterationsPassed = 0;
|
int iterationsPassed = 0;
|
||||||
quint64 start = usecTimestampNow();
|
quint64 totalElapsedAdd = 0;
|
||||||
|
quint64 totalElapsedFind = 0;
|
||||||
for (int i = 0; i < TEST_ITERATIONS; i++) {
|
for (int i = 0; i < TEST_ITERATIONS; i++) {
|
||||||
uint32_t id = i + 2; // make sure it doesn't collide with previous model ids
|
uint32_t id = i + 2; // make sure it doesn't collide with previous model ids
|
||||||
ModelItemID modelID(id);
|
ModelItemID modelID(id);
|
||||||
|
@ -261,38 +263,39 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
properties.setRadius(halfMeter);
|
properties.setRadius(halfMeter);
|
||||||
properties.setModelURL("https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/theater.fbx");
|
properties.setModelURL("https://s3-us-west-1.amazonaws.com/highfidelity-public/ozan/theater.fbx");
|
||||||
|
|
||||||
|
quint64 startAdd = usecTimestampNow();
|
||||||
tree.addModel(modelID, properties);
|
tree.addModel(modelID, properties);
|
||||||
|
quint64 endAdd = usecTimestampNow();
|
||||||
|
totalElapsedAdd += (endAdd - startAdd);
|
||||||
|
|
||||||
|
quint64 startFind = usecTimestampNow();
|
||||||
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
|
float targetRadius = oneMeter * 2.0 / (float)TREE_SCALE; // in tree units
|
||||||
const ModelItem* foundModelByRadius = tree.findClosestModel(randomPositionInTreeUnits, targetRadius);
|
const ModelItem* foundModelByRadius = tree.findClosestModel(randomPositionInTreeUnits, targetRadius);
|
||||||
const ModelItem* foundModelByID = tree.findModelByID(id);
|
const ModelItem* foundModelByID = tree.findModelByID(id);
|
||||||
ModelTreeElement* containingElement = tree.getContainingElement(modelID);
|
quint64 endFind = usecTimestampNow();
|
||||||
AACube elementCube = containingElement ? containingElement->getAACube() : AACube();
|
totalElapsedFind += (endFind - startFind);
|
||||||
|
|
||||||
if (verbose) {
|
if (extraVerbose) {
|
||||||
qDebug() << "foundModelByRadius=" << foundModelByRadius;
|
qDebug() << "foundModelByRadius=" << foundModelByRadius;
|
||||||
qDebug() << "foundModelByID=" << foundModelByID;
|
qDebug() << "foundModelByID=" << foundModelByID;
|
||||||
qDebug() << "containingElement=" << containingElement;
|
}
|
||||||
qDebug() << "containingElement.box="
|
|
||||||
<< elementCube.getCorner().x * TREE_SCALE << ","
|
// Every 1000th test, show the size of the tree...
|
||||||
<< elementCube.getCorner().y * TREE_SCALE << ","
|
if (verbose && (i % 1000 == 0)) {
|
||||||
<< elementCube.getCorner().z * TREE_SCALE << ":"
|
qDebug() << "after test:" << i << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
||||||
<< elementCube.getScale() * TREE_SCALE;
|
|
||||||
//containingElement->printDebugDetails("containingElement");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool passed = foundModelByRadius && foundModelByID && (foundModelByRadius == foundModelByID);
|
bool passed = foundModelByRadius && foundModelByID && (foundModelByRadius == foundModelByID);
|
||||||
if (passed) {
|
if (passed) {
|
||||||
iterationsPassed++;
|
iterationsPassed++;
|
||||||
} else {
|
} else {
|
||||||
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
|
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName) << "iteration:" << i
|
||||||
<< "foundModelByRadius=" << foundModelByRadius << "foundModelByID=" << foundModelByID
|
<< "foundModelByRadius=" << foundModelByRadius << "foundModelByID=" << foundModelByID
|
||||||
<< "x/y/z=" << randomX << "," << randomY << "," << randomZ;
|
<< "x/y/z=" << randomX << "," << randomY << "," << randomZ;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
quint64 end = usecTimestampNow();
|
|
||||||
|
qDebug() << "getOctreeElementsCount()=" << tree.getOctreeElementsCount();
|
||||||
|
|
||||||
bool passed = iterationsPassed == TEST_ITERATIONS;
|
bool passed = iterationsPassed == TEST_ITERATIONS;
|
||||||
if (passed) {
|
if (passed) {
|
||||||
|
@ -302,8 +305,11 @@ void ModelTests::modelTreeTests(bool verbose) {
|
||||||
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName);
|
qDebug() << "FAILED - Test" << testsTaken <<":" << qPrintable(testName);
|
||||||
}
|
}
|
||||||
float USECS_PER_MSECS = 1000.0f;
|
float USECS_PER_MSECS = 1000.0f;
|
||||||
float elapsedInMSecs = (float)(end - start) / USECS_PER_MSECS;
|
float elapsedInMSecsAdd = (float)(totalElapsedAdd) / USECS_PER_MSECS;
|
||||||
qDebug() << "TIME - Test" << testsTaken <<":" << qPrintable(testName) << "elapsed=" << elapsedInMSecs << "msecs";
|
float elapsedInMSecsFind = (float)(totalElapsedFind) / USECS_PER_MSECS;
|
||||||
|
qDebug() << "TIME - Test" << testsTaken <<":" << qPrintable(testName)
|
||||||
|
<< "elapsed Add=" << elapsedInMSecsAdd << "msecs"
|
||||||
|
<< "elapsed Find=" << elapsedInMSecsFind << "msecs";
|
||||||
}
|
}
|
||||||
|
|
||||||
qDebug() << " tests passed:" << testsPassed << "out of" << testsTaken;
|
qDebug() << " tests passed:" << testsPassed << "out of" << testsTaken;
|
||||||
|
|
Loading…
Reference in a new issue