History

some debug timing and voxel stats display

ZappoMan committed 13 years ago

Commit 023a5211 parent ca7225e2 files · +62 −31Browse files

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

Unified · Split

interface/src/Application.cpp+61−31
@@ -356,8 +356,9 @@ void Application::initializeGL() { · 355 unmodified lines
356356
357357 void Application::paintGL() {
358358 PerformanceWarning::setSuppressShortTimings(Menu::getInstance()->isOptionChecked(MenuOption::SuppressShortTimings));
359− PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings), "Application::paintGL()");
360−
359+ bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
360+ PerformanceWarning warn(showWarnings, "Application::paintGL()");
361+
361362 glEnable(GL_LINE_SMOOTH);
362363
363364 if (_myCamera.getMode() == CAMERA_MODE_MIRROR) {
@@ -545,6 +546,7 @@ void Application::keyPressEvent(QKeyEvent* event) { · 181 unmodified lines
545546 }
546547
547548 bool isShifted = event->modifiers().testFlag(Qt::ShiftModifier);
549+ bool isMeta = event->modifiers().testFlag(Qt::ControlModifier);
548550 switch (event->key()) {
549551 case Qt::Key_Shift:
550552 if (Menu::getInstance()->isOptionChecked(MenuOption::VoxelSelectMode)) {
@@ -619,8 +621,10 @@ void Application::keyPressEvent(QKeyEvent* event) { · 68 unmodified lines
619621 break;
620622
621623 case Qt::Key_S:
622− if (isShifted) {
624+ if (isShifted && !isMeta) {
623625 _voxels.collectStatsForTreesAndVBOs();
626+ } else if (isShifted && isMeta) {
627+ Menu::getInstance()->triggerOption(MenuOption::SuppressShortTimings);
624628 } else if (_nudgeStarted) {
625629 if (_lookingAlongX) {
626630 if (_lookingAwayFromOrigin) {
@@ -1238,6 +1242,8 @@ static glm::vec3 getFaceVector(BoxFace face) { · 611 unmodified lines
12381242 }
12391243
12401244 void Application::idle() {
1245+ bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1246+ PerformanceWarning warn(showWarnings, "Application::idle()");
12411247
12421248 timeval check;
12431249 gettimeofday(&check, NULL);
@@ -1252,7 +1258,7 @@ void Application::idle() { · 8 unmodified lines
12521258 _glWidget->updateGL();
12531259 _lastTimeUpdated = check;
12541260 _idleLoopStdev.addValue(timeSinceLastUpdate);
1255−
1261+
12561262 // Record standard deviation and reset counter if needed
12571263 const int STDEV_SAMPLES = 500;
12581264 if (_idleLoopStdev.getSamples() > STDEV_SAMPLES) {
@@ -1783,7 +1789,28 @@ void Application::renderFollowIndicator() { · 524 unmodified lines
17831789 }
17841790 }
17851791
1792+void Application::updateAvatars(float deltaTime, glm::vec3 mouseRayOrigin, glm::vec3 mouseRayDirection) {
1793+ bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1794+ PerformanceWarning warn(showWarnings, "Application::updateAvatars()");
1795+ NodeList* nodeList = NodeList::getInstance();
1796+
1797+ for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1798+ node->lock();
1799+ if (node->getLinkedData() != NULL) {
1800+ Avatar *avatar = (Avatar *)node->getLinkedData();
1801+ if (!avatar->isInitialized()) {
1802+ avatar->init();
1803+ }
1804+ avatar->simulate(deltaTime, NULL);
1805+ avatar->setMouseRay(mouseRayOrigin, mouseRayDirection);
1806+ }
1807+ node->unlock();
1808+ }
1809+}
1810+
17861811 void Application::update(float deltaTime) {
1812+ bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
1813+ PerformanceWarning warn(showWarnings, "Application::update()");
17871814
17881815 // Use Transmitter Hand to move hand if connected, else use mouse
17891816 if (_myTransmitter.isConnected()) {
@@ -1884,6 +1911,8 @@ void Application::update(float deltaTime) { · 94 unmodified lines
18841911 (fabs(_myAvatar.getVelocity().x) +
18851912 fabs(_myAvatar.getVelocity().y) +
18861913 fabs(_myAvatar.getVelocity().z)) / 3 < MAX_AVATAR_EDIT_VELOCITY) {
1914+ PerformanceWarning warn(showWarnings, "Application::update()... findRayIntersection()");
1915+
18871916 if (_voxels.findRayIntersection(mouseRayOrigin, mouseRayDirection, _mouseVoxel, distance, face)) {
18881917 if (distance < MAX_VOXEL_EDIT_DISTANCE) {
18891918 // find the nearest voxel with the desired scale
@@ -1991,22 +2020,11 @@ void Application::update(float deltaTime) { · 101 unmodified lines
19912020 _voxelProcessor.threadRoutine();
19922021 _voxelEditSender.threadRoutine();
19932022 }
2023+
19942024
19952025 //loop through all the other avatars and simulate them...
1996− NodeList* nodeList = NodeList::getInstance();
1997− for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
1998− node->lock();
1999− if (node->getLinkedData() != NULL) {
2000− Avatar *avatar = (Avatar *)node->getLinkedData();
2001− if (!avatar->isInitialized()) {
2002− avatar->init();
2003− }
2004− avatar->simulate(deltaTime, NULL);
2005− avatar->setMouseRay(mouseRayOrigin, mouseRayDirection);
2006− }
2007− node->unlock();
2008− }
2009−
2026+ updateAvatars(deltaTime, mouseRayOrigin, mouseRayDirection);
2027+
20102028 // Simulate myself
20112029 if (Menu::getInstance()->isOptionChecked(MenuOption::Gravity)) {
20122030 _myAvatar.setGravity(_environment.getGravity(_myAvatar.getPosition()));
@@ -2041,6 +2059,7 @@ void Application::update(float deltaTime) { · 28 unmodified lines
20412059 if (_voxels.findRayIntersection(_transmitterPickStart, direction, detail, distance, face)) {
20422060 minDistance = min(minDistance, distance);
20432061 }
2062+ NodeList* nodeList = NodeList::getInstance();
20442063 for(NodeList::iterator node = nodeList->begin(); node != nodeList->end(); node++) {
20452064 node->lock();
20462065 if (node->getLinkedData() != NULL) {
@@ -2134,6 +2153,8 @@ void Application::update(float deltaTime) { · 87 unmodified lines
21342153 }
21352154
21362155 void Application::updateAvatar(float deltaTime) {
2156+ bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
2157+ PerformanceWarning warn(showWarnings, "Application::updateAvatar()");
21372158
21382159 // rotate body yaw for yaw received from multitouch
21392160 _myAvatar.setOrientation(_myAvatar.getOrientation()
@@ -2990,10 +3011,11 @@ void Application::displayStats() { · 850 unmodified lines
29903011 std::stringstream voxelStats;
29913012 voxelStats.precision(4);
29923013 voxelStats << "Voxels Rendered: " << _voxels.getVoxelsRendered() / 1000.f << "K " <<
3014+ "Written: " << _voxels.getVoxelsWritten()/1000.f << "K " <<
29933015 "Updated: " << _voxels.getVoxelsUpdated()/1000.f << "K " <<
29943016 "Max: " << _voxels.getMaxVoxels()/1000.f << "K ";
29953017 statsVerticalOffset += PELS_PER_LINE;
2996− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
3018+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
29973019
29983020 voxelStats.str("");
29993021 voxelStats <<
@@ -3003,37 +3025,40 @@ void Application::displayStats() { · 3 unmodified lines
30033025 if (_voxels.hasVoxelMemoryUsageGPU()) {
30043026 voxelStats << "GPU: " << _voxels.getVoxelMemoryUsageGPU() / 1000000.f << "MB ";
30053027 }
3028+ statsVerticalOffset += PELS_PER_LINE;
3029+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
30063030
3007− // Some debugging for memory usage of VoxelNodes
3008− //voxelStats << "VoxelNode size: " << sizeof(VoxelNode) << " bytes ";
3009− //voxelStats << "AABox size: " << sizeof(AABox) << " bytes ";
3010−
3031+ voxelStats.str("");
3032+ voxelStats <<
3033+ "Local Voxels Total: " << VoxelNode::getNodeCount() << ", " <<
3034+ "Internal: " << VoxelNode::getInternalNodeCount() << " , " <<
3035+ "Leaves: " << VoxelNode::getLeafNodeCount() << "";
30113036 statsVerticalOffset += PELS_PER_LINE;
3012− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
3037+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
30133038
30143039 voxelStats.str("");
30153040 char* voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_VOXELS);
30163041 voxelStats << "Voxels Sent from Server: " << voxelDetails;
30173042 statsVerticalOffset += PELS_PER_LINE;
3018− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
3043+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
30193044
30203045 voxelStats.str("");
30213046 voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ELAPSED);
30223047 voxelStats << "Scene Send Time from Server: " << voxelDetails;
30233048 statsVerticalOffset += PELS_PER_LINE;
3024− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
3049+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
30253050
30263051 voxelStats.str("");
30273052 voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_ENCODE);
30283053 voxelStats << "Encode Time on Server: " << voxelDetails;
30293054 statsVerticalOffset += PELS_PER_LINE;
3030− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
3055+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
30313056
30323057 voxelStats.str("");
30333058 voxelDetails = _voxelSceneStats.getItemValue(VoxelSceneStats::ITEM_MODE);
30343059 voxelStats << "Sending Mode: " << voxelDetails;
30353060 statsVerticalOffset += PELS_PER_LINE;
3036− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)voxelStats.str().c_str());
3061+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)voxelStats.str().c_str());
30373062
30383063 Node *avatarMixer = NodeList::getInstance()->soloNodeOfType(NODE_TYPE_AVATAR_MIXER);
30393064 char avatarMixerStats[200];
@@ -3048,7 +3073,7 @@ void Application::displayStats() { · 8 unmodified lines
30483073 statsVerticalOffset += PELS_PER_LINE;
30493074 drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, avatarMixerStats);
30503075 statsVerticalOffset += PELS_PER_LINE;
3051− drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char *)LeapManager::statusString().c_str());
3076+ drawtext(10, statsVerticalOffset, 0.10f, 0, 1.0, 0, (char*)LeapManager::statusString().c_str());
30523077
30533078 if (_perfStatsOn) {
30543079 // Get the PerfStats group details. We need to allocate and array of char* long enough to hold 1+groups
@@ -3234,7 +3259,6 @@ void Application::renderCoverageMapsRecursively(CoverageMap* map) { · 179 unmodified lines
32343259
32353260
32363261
3237−/////////////////////////////////////////////////////////////////////////////////////
32383262 // renderViewFrustum()
32393263 //
32403264 // Description: this will render the view frustum bounds for EITHER the head
@@ -3316,7 +3340,7 @@ void Application::renderViewFrustum(ViewFrustum& viewFrustum) { · 75 unmodified lines
33163340 || Menu::getInstance()->getFrustumDrawMode() == FRUSTUM_DRAW_MODE_PLANES
33173341 || Menu::getInstance()->getFrustumDrawMode() == FRUSTUM_DRAW_MODE_FAR_PLANE) {
33183342 // viewFrustum.getFar plane - bottom edge
3319− glColor3f(0,1,0); // GREEN!!!
3343+ glColor3f(0,1,0);
33203344 glVertex3f(viewFrustum.getFarBottomLeft().x, viewFrustum.getFarBottomLeft().y, viewFrustum.getFarBottomLeft().z);
33213345 glVertex3f(viewFrustum.getFarBottomRight().x, viewFrustum.getFarBottomRight().y, viewFrustum.getFarBottomRight().z);
33223346
@@ -3684,6 +3708,9 @@ int Application::parseVoxelStats(unsigned char* messageData, ssize_t messageLeng · 361 unmodified lines
36843708
36853709 // Receive packets from other nodes/servers and decide what to do with them!
36863710 void* Application::networkReceive(void* args) {
3711+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
3712+ "Application::networkReceive()");
3713+
36873714 sockaddr senderAddress;
36883715 ssize_t bytesReceived;
36893716
@@ -3711,6 +3738,9 @@ void* Application::networkReceive(void* args) { · 21 unmodified lines
37113738 case PACKET_TYPE_ERASE_VOXEL:
37123739 case PACKET_TYPE_VOXEL_STATS:
37133740 case PACKET_TYPE_ENVIRONMENT_DATA: {
3741+ PerformanceWarning warn(Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings),
3742+ "Application::networkReceive()... _voxelProcessor.queueReceivedPacket()");
3743+
37143744 // add this packet to our list of voxel packets and process them on the voxel processing
37153745 app->_voxelProcessor.queueReceivedPacket(senderAddress, app->_incomingPacket, bytesReceived);
37163746 break;

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t