History

Merge pull request #11965 from AndrewMeadows/expose-physics-perf-stats-to-js

Cleanup names of debug stats and trace contexts.

Andrew Meadows committed 8 years ago

Commit cfd20972 parents 4d42dba 87fa91918 files · +264 −120Browse files

Showing the changes to interface/src/Application.cpp (1 of 18 files). Show all

Unified · Split

interface/src/Application.cpp+13−12
@@ -3222,8 +3222,6 @@ void Application::keyPressEvent(QKeyEvent* event) { · 3221 unmodified lines
32223222 }
32233223 }
32243224
3225−
3226−
32273225 void Application::keyReleaseEvent(QKeyEvent* event) {
32283226 _keysPressed.remove(event->key());
32293227
@@ -4848,8 +4846,7 @@ void Application::update(float deltaTime) { · 1618 unmodified lines
48484846 if (_physicsEnabled) {
48494847 {
48504848 PROFILE_RANGE(simulation_physics, "PreStep");
4851−
4852− PerformanceTimer perfTimer("updateStates)");
4849+ PerformanceTimer perfTimer("preStep)");
48534850 static VectorOfMotionStates motionStates;
48544851 _entitySimulation->getObjectsToRemoveFromPhysics(motionStates);
48554852 _physicsEngine->removeObjects(motionStates);
@@ -4882,22 +4879,22 @@ void Application::update(float deltaTime) { · 26 unmodified lines
48824879 }
48834880 {
48844881 PROFILE_RANGE(simulation_physics, "Step");
4885− PerformanceTimer perfTimer("stepSimulation");
4882+ PerformanceTimer perfTimer("step");
48864883 getEntities()->getTree()->withWriteLock([&] {
48874884 _physicsEngine->stepSimulation();
48884885 });
48894886 }
48904887 {
48914888 PROFILE_RANGE(simulation_physics, "PostStep");
4892− PerformanceTimer perfTimer("harvestChanges");
4889+ PerformanceTimer perfTimer("postStep");
48934890 if (_physicsEngine->hasOutgoingChanges()) {
48944891 // grab the collision events BEFORE handleOutgoingChanges() because at this point
48954892 // we have a better idea of which objects we own or should own.
48964893 auto& collisionEvents = _physicsEngine->getCollisionEvents();
48974894
48984895 getEntities()->getTree()->withWriteLock([&] {
4899− PROFILE_RANGE(simulation_physics, "Harvest");
4900− PerformanceTimer perfTimer("handleOutgoingChanges");
4896+ PROFILE_RANGE(simulation_physics, "HandleChanges");
4897+ PerformanceTimer perfTimer("handleChanges");
49014898
49024899 const VectorOfMotionStates& outgoingChanges = _physicsEngine->getChangedMotionStates();
49034900 _entitySimulation->handleChangedMotionStates(outgoingChanges);
@@ -4908,17 +4905,15 @@ void Application::update(float deltaTime) { · 4 unmodified lines
49084905 });
49094906
49104907 if (!_aboutToQuit) {
4911− // handleCollisionEvents() AFTER handleOutgoinChanges()
4908+ // handleCollisionEvents() AFTER handleOutgoingChanges()
49124909 {
49134910 PROFILE_RANGE(simulation_physics, "CollisionEvents");
4914− PerformanceTimer perfTimer("entities");
49154911 avatarManager->handleCollisionEvents(collisionEvents);
49164912 // Collision events (and their scripts) must not be handled when we're locked, above. (That would risk
49174913 // deadlock.)
49184914 _entitySimulation->handleCollisionEvents(collisionEvents);
49194915 }
49204916
4921− PROFILE_RANGE(simulation_physics, "UpdateEntities");
49224917 // NOTE: the getEntities()->update() call below will wait for lock
49234918 // and will simulate entity motion (the EntityTree has been given an EntitySimulation).
49244919 getEntities()->update(true); // update the models...
@@ -4929,7 +4924,8 @@ void Application::update(float deltaTime) { · 4 unmodified lines
49294924 myAvatar->harvestResultsFromPhysicsSimulation(deltaTime);
49304925 }
49314926
4932− if (Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
4927+ if (PerformanceTimer::isActive() &&
4928+ Menu::getInstance()->isOptionChecked(MenuOption::DisplayDebugTimingDetails) &&
49334929 Menu::getInstance()->isOptionChecked(MenuOption::ExpandPhysicsSimulationTiming)) {
49344930 _physicsEngine->harvestPerformanceStats();
49354931 }
@@ -7506,4 +7502,9 @@ void Application::setAvatarOverrideUrl(const QUrl& url, bool save) { · 2570 unmodified lines
75067502 _avatarOverrideUrl = url;
75077503 _saveAvatarOverrideUrl = save;
75087504 }
7505+
7506+void Application::saveNextPhysicsStats(QString filename) {
7507+ _physicsEngine->saveNextPhysicsStats(filename);
7508+}
7509+
75097510 #include "Application.moc"