mirror of
https://github.com/overte-org/overte.git
synced 2025-08-06 22:39:18 +02:00
Merge pull request #12907 from AndrewMeadows/more-correct-stats-002
more correct stats names
This commit is contained in:
commit
710bfb894a
7 changed files with 65 additions and 52 deletions
|
@ -5260,12 +5260,12 @@ void Application::update(float deltaTime) {
|
||||||
QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();
|
QSharedPointer<AvatarManager> avatarManager = DependencyManager::get<AvatarManager>();
|
||||||
|
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(simulation_physics, "Physics");
|
PROFILE_RANGE(simulation_physics, "Simulation");
|
||||||
PerformanceTimer perfTimer("physics");
|
PerformanceTimer perfTimer("simulation");
|
||||||
if (_physicsEnabled) {
|
if (_physicsEnabled) {
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(simulation_physics, "PreStep");
|
PROFILE_RANGE(simulation_physics, "PrePhysics");
|
||||||
PerformanceTimer perfTimer("preStep)");
|
PerformanceTimer perfTimer("prePhysics)");
|
||||||
{
|
{
|
||||||
const VectorOfMotionStates& motionStates = _entitySimulation->getObjectsToRemoveFromPhysics();
|
const VectorOfMotionStates& motionStates = _entitySimulation->getObjectsToRemoveFromPhysics();
|
||||||
_physicsEngine->removeObjects(motionStates);
|
_physicsEngine->removeObjects(motionStates);
|
||||||
|
@ -5299,59 +5299,63 @@ void Application::update(float deltaTime) {
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(simulation_physics, "Step");
|
PROFILE_RANGE(simulation_physics, "StepPhysics");
|
||||||
PerformanceTimer perfTimer("step");
|
PerformanceTimer perfTimer("stepPhysics");
|
||||||
getEntities()->getTree()->withWriteLock([&] {
|
getEntities()->getTree()->withWriteLock([&] {
|
||||||
_physicsEngine->stepSimulation();
|
_physicsEngine->stepSimulation();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(simulation_physics, "PostStep");
|
|
||||||
PerformanceTimer perfTimer("postStep");
|
|
||||||
if (_physicsEngine->hasOutgoingChanges()) {
|
if (_physicsEngine->hasOutgoingChanges()) {
|
||||||
// grab the collision events BEFORE handleOutgoingChanges() because at this point
|
{
|
||||||
// we have a better idea of which objects we own or should own.
|
PROFILE_RANGE(simulation_physics, "PostPhysics");
|
||||||
auto& collisionEvents = _physicsEngine->getCollisionEvents();
|
PerformanceTimer perfTimer("postPhysics");
|
||||||
|
// grab the collision events BEFORE handleChangedMotionStates() because at this point
|
||||||
|
// we have a better idea of which objects we own or should own.
|
||||||
|
auto& collisionEvents = _physicsEngine->getCollisionEvents();
|
||||||
|
|
||||||
getEntities()->getTree()->withWriteLock([&] {
|
getEntities()->getTree()->withWriteLock([&] {
|
||||||
PROFILE_RANGE(simulation_physics, "HandleChanges");
|
PROFILE_RANGE(simulation_physics, "HandleChanges");
|
||||||
PerformanceTimer perfTimer("handleChanges");
|
PerformanceTimer perfTimer("handleChanges");
|
||||||
|
|
||||||
const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates();
|
const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates();
|
||||||
_entitySimulation->handleChangedMotionStates(outgoingChanges);
|
_entitySimulation->handleChangedMotionStates(outgoingChanges);
|
||||||
avatarManager->handleChangedMotionStates(outgoingChanges);
|
avatarManager->handleChangedMotionStates(outgoingChanges);
|
||||||
|
|
||||||
const VectorOfMotionStates& deactivations = _physicsEngine->getDeactivatedMotionStates();
|
const VectorOfMotionStates& deactivations = _physicsEngine->getDeactivatedMotionStates();
|
||||||
_entitySimulation->handleDeactivatedMotionStates(deactivations);
|
_entitySimulation->handleDeactivatedMotionStates(deactivations);
|
||||||
});
|
});
|
||||||
|
|
||||||
if (!_aboutToQuit) {
|
if (!_aboutToQuit) {
|
||||||
// handleCollisionEvents() AFTER handleOutgoingChanges()
|
// handleCollisionEvents() AFTER handleChangedMotionStates()
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(simulation_physics, "CollisionEvents");
|
PROFILE_RANGE(simulation_physics, "CollisionEvents");
|
||||||
avatarManager->handleCollisionEvents(collisionEvents);
|
avatarManager->handleCollisionEvents(collisionEvents);
|
||||||
// Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
|
// Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
|
||||||
// deadlock.)
|
// deadlock.)
|
||||||
_entitySimulation->handleCollisionEvents(collisionEvents);
|
_entitySimulation->handleCollisionEvents(collisionEvents);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
{
|
||||||
|
PROFILE_RANGE(simulation_physics, "MyAvatar");
|
||||||
|
myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (PerformanceTimer::isActive() &&
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
|
||||||
|
Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsTiming)) {
|
||||||
|
_physicsEngine->harvestPerformanceStats();
|
||||||
|
}
|
||||||
|
// NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework
|
||||||
|
_physicsEngine->dumpStatsIfNecessary();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!_aboutToQuit) {
|
||||||
// NOTE: the getEntities()->update() call below will wait for lock
|
// NOTE: the getEntities()->update() call below will wait for lock
|
||||||
// and will simulate entity motion (the EntityTree has been given an EntitySimulation).
|
// and will provide non-physical entity motion
|
||||||
getEntities()->update(true); // update the models...
|
getEntities()->update(true); // update the models...
|
||||||
}
|
}
|
||||||
|
|
||||||
{
|
|
||||||
PROFILE_RANGE(simulation_physics, "MyAvatar");
|
|
||||||
myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (PerformanceTimer::isActive() &&
|
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
|
|
||||||
Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) {
|
|
||||||
_physicsEngine->harvestPerformanceStats();
|
|
||||||
}
|
|
||||||
// NOTE: the PhysicsEngine stats are written to stdout NOT to Qt log framework
|
|
||||||
_physicsEngine->dumpStatsIfNecessary();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
|
@ -683,11 +683,12 @@ Menu::Menu() {
|
||||||
qApp, SLOT(enablePerfStats(bool)));
|
qApp, SLOT(enablePerfStats(bool)));
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::OnlyDisplayTopTen, 0, true);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandUpdateTiming, 0, false);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandUpdateTiming, 0, false);
|
||||||
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandSimulationTiming, 0, false);
|
||||||
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandPhysicsTiming, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarTiming, 0, false);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarTiming, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarSimulateTiming, 0, false);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandMyAvatarSimulateTiming, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandOtherAvatarTiming, 0, false);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandOtherAvatarTiming, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandPaintGLTiming, 0, false);
|
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandPaintGLTiming, 0, false);
|
||||||
addCheckableActionToQMenuAndActionHash(perfTimerMenu, MenuOption::ExpandPhysicsSimulationTiming, 0, false);
|
|
||||||
|
|
||||||
addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::FrameTimer);
|
addCheckableActionToQMenuAndActionHash(timingMenu, MenuOption::FrameTimer);
|
||||||
addActionToQMenuAndActionHash(timingMenu, MenuOption::RunTimingTests, 0, qApp, SLOT(runTests()));
|
addActionToQMenuAndActionHash(timingMenu, MenuOption::RunTimingTests, 0, qApp, SLOT(runTests()));
|
||||||
|
|
|
@ -105,7 +105,8 @@ namespace MenuOption {
|
||||||
const QString ExpandMyAvatarTiming = "Expand /myAvatar";
|
const QString ExpandMyAvatarTiming = "Expand /myAvatar";
|
||||||
const QString ExpandOtherAvatarTiming = "Expand /otherAvatar";
|
const QString ExpandOtherAvatarTiming = "Expand /otherAvatar";
|
||||||
const QString ExpandPaintGLTiming = "Expand /paintGL";
|
const QString ExpandPaintGLTiming = "Expand /paintGL";
|
||||||
const QString ExpandPhysicsSimulationTiming = "Expand /physics";
|
const QString ExpandSimulationTiming = "Expand /simulation";
|
||||||
|
const QString ExpandPhysicsTiming = "Expand /physics";
|
||||||
const QString ExpandUpdateTiming = "Expand /update";
|
const QString ExpandUpdateTiming = "Expand /update";
|
||||||
const QString FirstPerson = "First Person";
|
const QString FirstPerson = "First Person";
|
||||||
const QString FirstPersonHMD = "Enter First Person Mode in HMD";
|
const QString FirstPersonHMD = "Enter First Person Mode in HMD";
|
||||||
|
|
|
@ -60,8 +60,8 @@ Stats::Stats(QQuickItem* parent) : QQuickItem(parent) {
|
||||||
bool Stats::includeTimingRecord(const QString& name) {
|
bool Stats::includeTimingRecord(const QString& name) {
|
||||||
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) {
|
if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails)) {
|
||||||
if (name.startsWith("/idle/update/")) {
|
if (name.startsWith("/idle/update/")) {
|
||||||
if (name.startsWith("/idle/update/physics/")) {
|
if (name.startsWith("/idle/update/simulation/")) {
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming);
|
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandSimulationTiming);
|
||||||
} else if (name.startsWith("/idle/update/myAvatar/")) {
|
} else if (name.startsWith("/idle/update/myAvatar/")) {
|
||||||
if (name.startsWith("/idle/update/myAvatar/simulate/")) {
|
if (name.startsWith("/idle/update/myAvatar/simulate/")) {
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandMyAvatarSimulateTiming);
|
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandMyAvatarSimulateTiming);
|
||||||
|
@ -75,8 +75,8 @@ bool Stats::includeTimingRecord(const QString& name) {
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPaintGLTiming);
|
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPaintGLTiming);
|
||||||
} else if (name.startsWith("/paintGL/")) {
|
} else if (name.startsWith("/paintGL/")) {
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPaintGLTiming);
|
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPaintGLTiming);
|
||||||
} else if (name.startsWith("step/")) {
|
} else if (name.startsWith("physics/")) {
|
||||||
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming);
|
return Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsTiming);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -479,7 +479,14 @@ void Stats::updateStats(bool force) {
|
||||||
float dt = (float)itr.value().getMovingAverage() / (float)USECS_PER_MSEC;
|
float dt = (float)itr.value().getMovingAverage() / (float)USECS_PER_MSEC;
|
||||||
_gameUpdateStats = QString("/idle/update = %1 ms").arg(dt);
|
_gameUpdateStats = QString("/idle/update = %1 ms").arg(dt);
|
||||||
|
|
||||||
QVector<QString> categories = { "devices", "physics", "otherAvatars", "MyAvatar", "misc" };
|
QVector<QString> categories = {
|
||||||
|
"devices",
|
||||||
|
"MyAvatar",
|
||||||
|
"otherAvatars",
|
||||||
|
"pickManager",
|
||||||
|
"pointerManager",
|
||||||
|
"simulation"
|
||||||
|
};
|
||||||
for (int32_t j = 0; j < categories.size(); ++j) {
|
for (int32_t j = 0; j < categories.size(); ++j) {
|
||||||
QString recordKey = "/idle/update/" + categories[j];
|
QString recordKey = "/idle/update/" + categories[j];
|
||||||
itr = allRecords.find(recordKey);
|
itr = allRecords.find(recordKey);
|
||||||
|
|
|
@ -132,7 +132,7 @@ protected:
|
||||||
//
|
//
|
||||||
// (2) For locally owned simulation: we store the last values sent to the server, integrated forward over time
|
// (2) For locally owned simulation: we store the last values sent to the server, integrated forward over time
|
||||||
// according to how we think the server doing it. We calculate the error between the true local transform
|
// according to how we think the server doing it. We calculate the error between the true local transform
|
||||||
// and the remote to decide when to send another update.
|
// and the remote to decide whether to send another update or not.
|
||||||
//
|
//
|
||||||
glm::vec3 _serverPosition; // in simulation-frame (not world-frame)
|
glm::vec3 _serverPosition; // in simulation-frame (not world-frame)
|
||||||
glm::quat _serverRotation;
|
glm::quat _serverRotation;
|
||||||
|
|
|
@ -41,7 +41,7 @@ void PhysicalEntitySimulation::init(
|
||||||
|
|
||||||
// begin EntitySimulation overrides
|
// begin EntitySimulation overrides
|
||||||
void PhysicalEntitySimulation::updateEntitiesInternal(uint64_t now) {
|
void PhysicalEntitySimulation::updateEntitiesInternal(uint64_t now) {
|
||||||
// Do nothing here because the "internal" update the PhysicsEngine::stepSimualtion() which is done elsewhere.
|
// Do nothing here because the "internal" update the PhysicsEngine::stepSimulation() which is done elsewhere.
|
||||||
}
|
}
|
||||||
|
|
||||||
void PhysicalEntitySimulation::addEntityInternal(EntityItemPointer entity) {
|
void PhysicalEntitySimulation::addEntityInternal(EntityItemPointer entity) {
|
||||||
|
|
|
@ -413,7 +413,7 @@ void PhysicsEngine::harvestPerformanceStats() {
|
||||||
if (QString(itr->Get_Current_Name()) == "stepSimulation") {
|
if (QString(itr->Get_Current_Name()) == "stepSimulation") {
|
||||||
itr->Enter_Child(childIndex);
|
itr->Enter_Child(childIndex);
|
||||||
StatsHarvester harvester;
|
StatsHarvester harvester;
|
||||||
harvester.recurse(itr, "step/");
|
harvester.recurse(itr, "physics/");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
itr->Next();
|
itr->Next();
|
||||||
|
|
Loading…
Reference in a new issue