From ce6570fc5b6c8c9282cf3000e1b2322a08549f77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Alejandro=20Hern=C3=A1ndez=20Cordero?= Date: Sat, 3 Oct 2020 02:16:30 +0200 Subject: [PATCH] [Gazebo 9] Added Profiler to gazebo::rendering and gzclient (#2836) Signed-off-by: ahcorde Signed-off-by: Louise Poubel Co-authored-by: Louise Poubel --- gazebo/common/Profiler.hh | 1 - gazebo/gui/GLWidget.cc | 22 ++++++++++++++----- gazebo/gui/GuiIface.cc | 3 +++ gazebo/gui/main.cc | 3 +++ gazebo/rendering/ApplyWrenchVisual.cc | 4 ++++ gazebo/rendering/Camera.cc | 3 +++ gazebo/rendering/CameraVisual.cc | 4 ++++ gazebo/rendering/ContactVisual.cc | 4 ++++ gazebo/rendering/DynamicLines.cc | 2 ++ gazebo/rendering/FPSViewController.cc | 2 ++ gazebo/rendering/GpuLaser.cc | 2 ++ gazebo/rendering/LaserVisual.cc | 4 ++++ gazebo/rendering/LensFlare.cc | 4 ++++ gazebo/rendering/Light.cc | 2 ++ gazebo/rendering/MarkerVisual.cc | 2 ++ gazebo/rendering/Material.cc | 2 ++ gazebo/rendering/MovableText.cc | 2 ++ gazebo/rendering/OculusCamera.cc | 4 ++++ gazebo/rendering/RTShaderSystem.cc | 4 ++++ gazebo/rendering/RenderEngine.cc | 4 ++++ gazebo/rendering/Scene.cc | 2 ++ gazebo/rendering/SonarVisual.cc | 4 ++++ gazebo/rendering/TransmitterVisual.cc | 4 ++++ gazebo/rendering/UserCamera.cc | 2 ++ gazebo/rendering/VideoVisual.cc | 4 +++- gazebo/rendering/Visual.cc | 5 ++++- gazebo/rendering/WrenchVisual.cc | 4 ++++ gazebo/rendering/skyx/src/CloudsManager.cpp | 5 ++++- gazebo/rendering/skyx/src/SkyX.cpp | 5 ++++- .../rendering/skyx/src/VClouds/Lightning.cpp | 4 +++- gazebo/rendering/skyx/src/VCloudsManager.cpp | 4 +++- gazebo/sensors/CameraSensor.cc | 5 +++++ gazebo/sensors/GpuRaySensor.cc | 5 +++++ gazebo/sensors/MultiCameraSensor.cc | 1 + gazebo/server_main.cc | 3 +++ 35 files changed, 123 insertions(+), 12 deletions(-) diff --git a/gazebo/common/Profiler.hh b/gazebo/common/Profiler.hh index e1aa7a61a6..bbbe57a221 100644 --- a/gazebo/common/Profiler.hh +++ b/gazebo/common/Profiler.hh @@ -27,7 +27,6 @@ #include #include "gazebo/common/SingletonT.hh" -#include "gazebo/common/Remotery/lib/Remotery.h" #include "gazebo/util/system.hh" /// \brief Explicit instantiation for typed SingletonT. diff --git a/gazebo/gui/GLWidget.cc b/gazebo/gui/GLWidget.cc index 6584cf8e47..e879036103 100644 --- a/gazebo/gui/GLWidget.cc +++ b/gazebo/gui/GLWidget.cc @@ -24,6 +24,7 @@ #include "gazebo/common/Assert.hh" #include "gazebo/common/Exception.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/Conversions.hh" #include "gazebo/rendering/FPSViewController.hh" #include "gazebo/rendering/Heightmap.hh" @@ -279,16 +280,27 @@ void GLWidget::paintEvent(QPaintEvent *_e) rendering::UserCameraPtr cam = gui::get_active_camera(); if (cam && cam->Initialized()) { - event::Events::preRender(); - + { + GZ_PROFILE("gui::GLWidget::paintEvent pre-render"); + event::Events::preRender(); + } // Tell all the cameras to render - event::Events::render(); + { + GZ_PROFILE("gui::GLWidget::paintEvent render"); + event::Events::render(); + } - event::Events::postRender(); + { + GZ_PROFILE("gui::GLWidget::paintEvent post-render"); + event::Events::postRender(); + } } else { - event::Events::preRender(); + { + GZ_PROFILE("gui::GLWidget::paintEvent pre-render"); + event::Events::preRender(); + } } _e->accept(); diff --git a/gazebo/gui/GuiIface.cc b/gazebo/gui/GuiIface.cc index baeb340292..f5361770fd 100644 --- a/gazebo/gui/GuiIface.cc +++ b/gazebo/gui/GuiIface.cc @@ -34,6 +34,7 @@ #include "gazebo/common/ModelDatabase.hh" #include "gazebo/common/Console.hh" #include "gazebo/common/Plugin.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/common/CommonTypes.hh" #include "gazebo/gui/SplashScreen.hh" #include "gazebo/gui/MainWindow.hh" @@ -382,6 +383,8 @@ unsigned int gui::get_entity_id(const std::string &_name) ///////////////////////////////////////////////// bool gui::run(int _argc, char **_argv) { + GZ_PROFILE_THREAD_NAME("gzclient"); + // Initialize the informational logger. This will log warnings, and errors. gzLogInit("client-", "gzclient.log"); diff --git a/gazebo/gui/main.cc b/gazebo/gui/main.cc index 465e79dc42..4c971f5a3d 100644 --- a/gazebo/gui/main.cc +++ b/gazebo/gui/main.cc @@ -22,6 +22,9 @@ ////////////////////////////////////////////////// int main(int _argc, char **_argv) { +#ifndef _WIN32 + ::setenv("RMT_PORT", "1501", true); +#endif Q_INIT_RESOURCE(resources); int result = 0; try diff --git a/gazebo/rendering/ApplyWrenchVisual.cc b/gazebo/rendering/ApplyWrenchVisual.cc index be963d7ffe..1de03fbaca 100644 --- a/gazebo/rendering/ApplyWrenchVisual.cc +++ b/gazebo/rendering/ApplyWrenchVisual.cc @@ -19,6 +19,7 @@ #include #include "gazebo/common/MeshManager.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/Material.hh" #include "gazebo/rendering/MovableText.hh" @@ -307,6 +308,7 @@ void ApplyWrenchVisual::SetTorque(const ignition::math::Vector3d &_torqueVector, /////////////////////////////////////////////////// void ApplyWrenchVisual::UpdateForceVisual() { + GZ_PROFILE("ApplyWrenchVisual::UpdateForceVisual"); ApplyWrenchVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); @@ -342,6 +344,7 @@ void ApplyWrenchVisual::UpdateForceVisual() /////////////////////////////////////////////////// void ApplyWrenchVisual::UpdateTorqueVisual() { + GZ_PROFILE("ApplyWrenchVisual::UpdateTorqueVisual"); ApplyWrenchVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); @@ -380,6 +383,7 @@ void ApplyWrenchVisual::UpdateTorqueVisual() ///////////////////////////////////////////////// void ApplyWrenchVisual::Resize() { + GZ_PROFILE("ApplyWrenchVisual::Resize"); ApplyWrenchVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); diff --git a/gazebo/rendering/Camera.cc b/gazebo/rendering/Camera.cc index 3bff158b98..7dfddabe3a 100644 --- a/gazebo/rendering/Camera.cc +++ b/gazebo/rendering/Camera.cc @@ -36,6 +36,7 @@ #include "gazebo/common/Events.hh" #include "gazebo/common/Console.hh" #include "gazebo/common/Exception.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/common/VideoEncoder.hh" #include "gazebo/rendering/ogre_gazebo.h" @@ -408,6 +409,7 @@ void Camera::SetScene(ScenePtr _scene) ////////////////////////////////////////////////// void Camera::Update() { + GZ_PROFILE("rendering::Camera::Update"); std::lock_guard lock(this->dataPtr->receiveMutex); // Process all the command messages. @@ -539,6 +541,7 @@ void Camera::Update() ////////////////////////////////////////////////// void Camera::Render(const bool _force) { + GZ_PROFILE("rendering::Camera::Render"); if (this->initialized && (_force || common::Time::GetWallTime() - this->lastRenderWallTime >= this->dataPtr->renderPeriod)) diff --git a/gazebo/rendering/CameraVisual.cc b/gazebo/rendering/CameraVisual.cc index 18269c5318..e3c1bc84eb 100644 --- a/gazebo/rendering/CameraVisual.cc +++ b/gazebo/rendering/CameraVisual.cc @@ -17,6 +17,7 @@ #include +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/ogre_gazebo.h" #include "gazebo/rendering/RenderEngine.hh" #include "gazebo/rendering/DynamicLines.hh" @@ -127,11 +128,14 @@ void CameraVisual::Load(const msgs::CameraSensor &_msg) ///////////////////////////////////////////////// void CameraVisual::Update() { + GZ_PROFILE("rendering::CameraVisual::Update"); CameraVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); if (!dPtr->camera) + { return; + } dPtr->camera->Render(); } diff --git a/gazebo/rendering/ContactVisual.cc b/gazebo/rendering/ContactVisual.cc index 961e141ae6..19b54fb317 100644 --- a/gazebo/rendering/ContactVisual.cc +++ b/gazebo/rendering/ContactVisual.cc @@ -19,6 +19,7 @@ */ #include +#include "gazebo/common/Profiler.hh" #include "gazebo/common/MeshManager.hh" #include "gazebo/transport/Node.hh" #include "gazebo/transport/Subscriber.hh" @@ -69,13 +70,16 @@ ContactVisual::~ContactVisual() ///////////////////////////////////////////////// void ContactVisual::Update() { + GZ_PROFILE("rendering::ContactVisual::Update"); ContactVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); boost::mutex::scoped_lock lock(dPtr->mutex); if (!dPtr->contactsMsg || !dPtr->receivedMsg) + { return; + } // The following values are used to calculate normal scaling factor based // on force value. diff --git a/gazebo/rendering/DynamicLines.cc b/gazebo/rendering/DynamicLines.cc index 8f777290d4..d15c0d3e00 100644 --- a/gazebo/rendering/DynamicLines.cc +++ b/gazebo/rendering/DynamicLines.cc @@ -23,6 +23,7 @@ #include "gazebo/common/Console.hh" #include "gazebo/common/Exception.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/DynamicLines.hh" using namespace gazebo; @@ -158,6 +159,7 @@ void DynamicLines::Clear() ///////////////////////////////////////////////// void DynamicLines::Update() { + GZ_PROFILE("rendering::DynamicLines::Update"); if (this->dirty && this->points.size() > 1) this->FillHardwareBuffers(); } diff --git a/gazebo/rendering/FPSViewController.cc b/gazebo/rendering/FPSViewController.cc index 9f5ae91623..05a66238a8 100644 --- a/gazebo/rendering/FPSViewController.cc +++ b/gazebo/rendering/FPSViewController.cc @@ -14,6 +14,7 @@ * limitations under the License. * */ +#include "gazebo/common/Profiler.hh" #include "gazebo/common/MouseEvent.hh" #include "gazebo/rendering/UserCamera.hh" @@ -52,6 +53,7 @@ void FPSViewController::Init() ////////////////////////////////////////////////// void FPSViewController::Update() { + GZ_PROFILE("rendering::FPSViewController::Update"); if (this->xVelocity != ignition::math::Vector3d::Zero || this->yVelocity != ignition::math::Vector3d::Zero) { diff --git a/gazebo/rendering/GpuLaser.cc b/gazebo/rendering/GpuLaser.cc index fd368d32ab..34a15a80e0 100644 --- a/gazebo/rendering/GpuLaser.cc +++ b/gazebo/rendering/GpuLaser.cc @@ -34,6 +34,7 @@ #include "gazebo/common/Events.hh" #include "gazebo/common/Console.hh" #include "gazebo/common/Exception.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/common/Mesh.hh" #include "gazebo/common/MeshManager.hh" #include "gazebo/common/Timer.hh" @@ -412,6 +413,7 @@ void GpuLaser::notifyRenderSingleObject(Ogre::Renderable *_rend, ////////////////////////////////////////////////// void GpuLaser::RenderImpl() { + GZ_PROFILE("rendering::GpuLaser::RenderImpl"); common::Timer firstPassTimer, secondPassTimer; firstPassTimer.Start(); diff --git a/gazebo/rendering/LaserVisual.cc b/gazebo/rendering/LaserVisual.cc index 99d60e2558..ef9a4df91f 100644 --- a/gazebo/rendering/LaserVisual.cc +++ b/gazebo/rendering/LaserVisual.cc @@ -17,6 +17,7 @@ #include +#include "gazebo/common/Profiler.hh" #include "gazebo/common/MeshManager.hh" #include "gazebo/transport/transport.hh" @@ -89,6 +90,7 @@ void LaserVisual::OnScan(ConstLaserScanStampedPtr &_msg) ///////////////////////////////////////////////// void LaserVisual::Update() { + GZ_PROFILE("rendering::LaserVisual::Update"); LaserVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); @@ -103,7 +105,9 @@ void LaserVisual::Update() } if (!dPtr->laserMsg || !dPtr->receivedMsg) + { return; + } dPtr->receivedMsg = false; diff --git a/gazebo/rendering/LensFlare.cc b/gazebo/rendering/LensFlare.cc index ba0afd8d42..fe723faacf 100644 --- a/gazebo/rendering/LensFlare.cc +++ b/gazebo/rendering/LensFlare.cc @@ -18,6 +18,7 @@ #include #include "gazebo/common/Assert.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/transport/Node.hh" @@ -443,6 +444,7 @@ void LensFlare::SetScale(const double _scale) ////////////////////////////////////////////////// void LensFlare::Update() { + GZ_PROFILE("rendering::LensFlare::Update"); std::lock_guard lock(this->dataPtr->mutex); // remove lens flare if we got a delete msg if (this->dataPtr->removeLensFlare) @@ -468,7 +470,9 @@ void LensFlare::Update() } } if (!directionalLight) + { return; + } this->dataPtr->lightName = directionalLight->Name(); diff --git a/gazebo/rendering/Light.cc b/gazebo/rendering/Light.cc index 7bfcd49b0e..f04f66b04a 100644 --- a/gazebo/rendering/Light.cc +++ b/gazebo/rendering/Light.cc @@ -22,6 +22,7 @@ #include "gazebo/common/Events.hh" #include "gazebo/common/Exception.hh" #include "gazebo/common/Console.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/Scene.hh" #include "gazebo/rendering/DynamicLines.hh" @@ -114,6 +115,7 @@ void Light::Load() ////////////////////////////////////////////////// void Light::Update() { + GZ_PROFILE("rendering::Light::Update"); // shadow support is also affected by light type so set type first. this->SetLightType(this->dataPtr->sdf->Get("type")); this->SetCastShadows(this->dataPtr->sdf->Get("cast_shadows")); diff --git a/gazebo/rendering/MarkerVisual.cc b/gazebo/rendering/MarkerVisual.cc index 0bb6f23253..bf8ead1fa4 100644 --- a/gazebo/rendering/MarkerVisual.cc +++ b/gazebo/rendering/MarkerVisual.cc @@ -15,6 +15,7 @@ * */ #include "gazebo/common/Console.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/RenderEvents.hh" #include "gazebo/rendering/DynamicLines.hh" #include "gazebo/rendering/Scene.hh" @@ -188,6 +189,7 @@ common::Time MarkerVisual::Lifetime() const ///////////////////////////////////////////////// void MarkerVisual::DynamicRenderable(const ignition::msgs::Marker &_msg) { + GZ_PROFILE("rendering::MarkerVisual::DynamicRenderable"); if (!this->dPtr->dynamicRenderable) { switch (_msg.type()) diff --git a/gazebo/rendering/Material.cc b/gazebo/rendering/Material.cc index ef472c7141..f8c8ce5a67 100644 --- a/gazebo/rendering/Material.cc +++ b/gazebo/rendering/Material.cc @@ -15,6 +15,7 @@ * */ #include "gazebo/common/Color.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/ogre_gazebo.h" #include "gazebo/common/Console.hh" #include "gazebo/rendering/RenderEngine.hh" @@ -140,6 +141,7 @@ void Material::CreateMaterials() ////////////////////////////////////////////////// void Material::Update(const gazebo::common::Material *_mat) { + GZ_PROFILE("rendering::Material::Update"); Ogre::MaterialPtr matPtr; if (Ogre::MaterialManager::getSingleton().resourceExists(_mat->GetName())) diff --git a/gazebo/rendering/MovableText.cc b/gazebo/rendering/MovableText.cc index 3bf7e74117..525d750e42 100644 --- a/gazebo/rendering/MovableText.cc +++ b/gazebo/rendering/MovableText.cc @@ -33,6 +33,7 @@ #include "gazebo/common/common.hh" #include "gazebo/common/Assert.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/MovableText.hh" #define POS_TEX_BINDING 0 @@ -176,6 +177,7 @@ void MovableText::Load(const std::string &_name, ////////////////////////////////////////////////// void MovableText::Update() { + GZ_PROFILE("rendering::MovableText::Update"); if (this->dataPtr->dirty) { this->SetupGeometry(); diff --git a/gazebo/rendering/OculusCamera.cc b/gazebo/rendering/OculusCamera.cc index 051d2a4349..d9c86a30fa 100644 --- a/gazebo/rendering/OculusCamera.cc +++ b/gazebo/rendering/OculusCamera.cc @@ -25,6 +25,7 @@ #include "gazebo/common/Console.hh" #include "gazebo/common/Exception.hh" #include "gazebo/common/Events.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/skyx/include/SkyX.h" #include "gazebo/rendering/selection_buffer/SelectionBuffer.hh" @@ -235,8 +236,11 @@ void OculusCamera::RenderImpl() ////////////////////////////////////////////////// void OculusCamera::Update() { + GZ_PROFILE("rendering::OculusCamera::Update"); if (!this->Ready()) + { return; + } Camera::Update(); diff --git a/gazebo/rendering/RTShaderSystem.cc b/gazebo/rendering/RTShaderSystem.cc index 055e734711..0ccd59dc7a 100644 --- a/gazebo/rendering/RTShaderSystem.cc +++ b/gazebo/rendering/RTShaderSystem.cc @@ -37,6 +37,7 @@ #include "gazebo/common/Console.hh" #include "gazebo/common/Exception.hh" #include "gazebo/common/SystemPaths.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/ogre_gazebo.h" #include "gazebo/rendering/CustomPSSMShadowCameraSetup.hh" #include "gazebo/rendering/RenderEngine.hh" @@ -634,8 +635,11 @@ Ogre::PSSMShadowCameraSetup *RTShaderSystem::GetPSSMShadowCameraSetup() const ///////////////////////////////////////////////// void RTShaderSystem::Update() { + GZ_PROFILE("rendering::RTShaderSystem::Update"); if (!this->dataPtr->initialized || !this->dataPtr->updateShaders) + { return; + } for (const auto &scene : this->dataPtr->scenes) { diff --git a/gazebo/rendering/RenderEngine.cc b/gazebo/rendering/RenderEngine.cc index f2a642df29..5adeb91db9 100644 --- a/gazebo/rendering/RenderEngine.cc +++ b/gazebo/rendering/RenderEngine.cc @@ -39,6 +39,7 @@ #include "gazebo/common/Events.hh" #include "gazebo/common/Exception.hh" #include "gazebo/common/Console.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/common/SystemPaths.hh" #include "gazebo/rendering/ogre_gazebo.h" @@ -261,17 +262,20 @@ unsigned int RenderEngine::SceneCount() const ////////////////////////////////////////////////// void RenderEngine::PreRender() { + GZ_PROFILE("rendering::RenderEngine::PreRender"); this->dataPtr->root->_fireFrameStarted(); } ////////////////////////////////////////////////// void RenderEngine::Render() { + GZ_PROFILE("rendering::RenderEngine::Render"); } ////////////////////////////////////////////////// void RenderEngine::PostRender() { + GZ_PROFILE("rendering::RenderEngine::PostRender"); // _fireFrameRenderingQueued was here for CEGUI to work. Leaving because // it shouldn't harm anything, and we don't want to introduce // a regression. diff --git a/gazebo/rendering/Scene.cc b/gazebo/rendering/Scene.cc index 5d851b768b..96c137492c 100644 --- a/gazebo/rendering/Scene.cc +++ b/gazebo/rendering/Scene.cc @@ -30,6 +30,7 @@ #include "gazebo/common/Exception.hh" #include "gazebo/common/Assert.hh" #include "gazebo/common/Console.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/Road2d.hh" #include "gazebo/rendering/Projector.hh" #include "gazebo/rendering/Heightmap.hh" @@ -1789,6 +1790,7 @@ void Scene::OnVisualMsg(ConstVisualPtr &_msg) ////////////////////////////////////////////////// void Scene::PreRender() { + GZ_PROFILE("rendering::Scene::PreRender"); /* Deferred shading debug code. Delete me soon (July 17, 2012) static bool first = true; diff --git a/gazebo/rendering/SonarVisual.cc b/gazebo/rendering/SonarVisual.cc index 58cb2949a3..685273fa08 100644 --- a/gazebo/rendering/SonarVisual.cc +++ b/gazebo/rendering/SonarVisual.cc @@ -16,6 +16,7 @@ */ #include +#include "gazebo/common/Profiler.hh" #include "gazebo/common/MeshManager.hh" #include "gazebo/transport/transport.hh" @@ -96,13 +97,16 @@ void SonarVisual::OnMsg(ConstSonarStampedPtr &_msg) ///////////////////////////////////////////////// void SonarVisual::Update() { + GZ_PROFILE("rendering::SonarVisual::Update"); SonarVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); boost::mutex::scoped_lock lock(dPtr->mutex); if (!dPtr->sonarMsg || !dPtr->receivedMsg) + { return; + } // Skip the update if the user is moving the sonar. if (this->GetScene()->SelectedVisual() && diff --git a/gazebo/rendering/TransmitterVisual.cc b/gazebo/rendering/TransmitterVisual.cc index 3da3c7075e..08173eedf9 100644 --- a/gazebo/rendering/TransmitterVisual.cc +++ b/gazebo/rendering/TransmitterVisual.cc @@ -16,6 +16,7 @@ */ #include +#include "gazebo/common/Profiler.hh" #include "gazebo/transport/transport.hh" #include "gazebo/rendering/Scene.hh" #include "gazebo/rendering/DynamicLines.hh" @@ -88,6 +89,7 @@ void TransmitterVisual::OnNewPropagationGrid(ConstPropagationGridPtr &_msg) //////////////////////////////////////////////// void TransmitterVisual::Update() { + GZ_PROFILE("rendering::TransmitterVisual::Update"); TransmitterVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); @@ -96,7 +98,9 @@ void TransmitterVisual::Update() boost::mutex::scoped_lock lock(dPtr->mutex); if (!dPtr->gridMsg || !dPtr->receivedMsg) + { return; + } // Update the visualization of the last propagation grid received dPtr->receivedMsg = false; diff --git a/gazebo/rendering/UserCamera.cc b/gazebo/rendering/UserCamera.cc index 741e04905e..73a7374ac7 100644 --- a/gazebo/rendering/UserCamera.cc +++ b/gazebo/rendering/UserCamera.cc @@ -23,6 +23,7 @@ #include "gazebo/common/Assert.hh" #include "gazebo/common/Console.hh" #include "gazebo/common/Events.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/rendering/selection_buffer/SelectionBuffer.hh" #include "gazebo/rendering/RenderEngine.hh" @@ -230,6 +231,7 @@ void UserCamera::SetWorldPose(const ignition::math::Pose3d &_pose) ////////////////////////////////////////////////// void UserCamera::Update() { + GZ_PROFILE("rendering::UserCamera::Update"); Camera::Update(); if (this->dataPtr->viewController) diff --git a/gazebo/rendering/VideoVisual.cc b/gazebo/rendering/VideoVisual.cc index 20705203d7..9c99138645 100644 --- a/gazebo/rendering/VideoVisual.cc +++ b/gazebo/rendering/VideoVisual.cc @@ -16,8 +16,9 @@ */ #include -#include "gazebo/common/Video.hh" #include "gazebo/common/Events.hh" +#include "gazebo/common/Profiler.hh" +#include "gazebo/common/Video.hh" #include "gazebo/rendering/ogre_gazebo.h" #include "gazebo/rendering/VideoVisualPrivate.hh" @@ -110,6 +111,7 @@ VideoVisual::~VideoVisual() ///////////////////////////////////////////////// void VideoVisual::PreRender() { + GZ_PROFILE("rendering::VideoVisual::PreRender"); VideoVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); diff --git a/gazebo/rendering/Visual.cc b/gazebo/rendering/Visual.cc index 52063c6c4f..6156484555 100644 --- a/gazebo/rendering/Visual.cc +++ b/gazebo/rendering/Visual.cc @@ -25,6 +25,7 @@ #include "gazebo/common/Event.hh" #include "gazebo/common/Events.hh" #include "gazebo/common/CommonIface.hh" +#include "gazebo/common/Profiler.hh" #include "gazebo/common/MeshManager.hh" #include "gazebo/common/Console.hh" #include "gazebo/common/Exception.hh" @@ -530,9 +531,11 @@ void Visual::Load() ////////////////////////////////////////////////// void Visual::Update() { + GZ_PROFILE("rendering::Visual::Update"); if (!this->dataPtr->visible) + { return; - + } std::list::iterator iter; // Update the lines diff --git a/gazebo/rendering/WrenchVisual.cc b/gazebo/rendering/WrenchVisual.cc index e161dabbf4..1de54abf39 100644 --- a/gazebo/rendering/WrenchVisual.cc +++ b/gazebo/rendering/WrenchVisual.cc @@ -16,6 +16,7 @@ */ #include +#include "gazebo/common/Profiler.hh" #include "gazebo/common/MeshManager.hh" #include "gazebo/transport/transport.hh" @@ -159,13 +160,16 @@ void WrenchVisual::Load(ConstJointPtr &_msg) ///////////////////////////////////////////////// void WrenchVisual::Update() { + GZ_PROFILE("rendering::WrenchVisual::Update"); WrenchVisualPrivate *dPtr = reinterpret_cast(this->dataPtr); boost::mutex::scoped_lock lock(dPtr->mutex); if (!dPtr->wrenchMsg || !dPtr->receivedMsg) + { return; + } double magScale = 100; double vMax = 0.5; diff --git a/gazebo/rendering/skyx/src/CloudsManager.cpp b/gazebo/rendering/skyx/src/CloudsManager.cpp index 89fb700ce9..05140f78c9 100644 --- a/gazebo/rendering/skyx/src/CloudsManager.cpp +++ b/gazebo/rendering/skyx/src/CloudsManager.cpp @@ -3,7 +3,7 @@ This source file is part of SkyX. Visit http://www.paradise-studios.net/products/skyx/ - Copyright (C) 2009-2012 Xavier Verguín González + Copyright (C) 2009-2012 Xavier Verguín González This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -25,6 +25,8 @@ #include "SkyX.h" +#include "gazebo/common/Profiler.hh" + namespace SkyX { /// -------------- CloudLayer ----------------- @@ -365,6 +367,7 @@ namespace SkyX void CloudsManager::update() { + GZ_PROFILE("rendering::CloudsManager::Update"); for (CloudLayersIt = mCloudLayers.begin(); CloudLayersIt != mCloudLayers.end(); CloudLayersIt++) { diff --git a/gazebo/rendering/skyx/src/SkyX.cpp b/gazebo/rendering/skyx/src/SkyX.cpp index 53c918da8a..e95742e1c8 100644 --- a/gazebo/rendering/skyx/src/SkyX.cpp +++ b/gazebo/rendering/skyx/src/SkyX.cpp @@ -3,7 +3,7 @@ This source file is part of SkyX. Visit http://www.paradise-studios.net/products/skyx/ -Copyright (C) 2009-2012 Xavier Verguín González +Copyright (C) 2009-2012 Xavier Verguín González This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -27,6 +27,8 @@ Place - Suite 330, Boston, MA 02111-1307, USA, or go to #include "SkyX.h" +#include "gazebo/common/Profiler.hh" + namespace SkyX { SkyX::SkyX(Ogre::SceneManager* sm, Controller* c) @@ -142,6 +144,7 @@ namespace SkyX void SkyX::update(const Ogre::Real& timeSinceLastFrame) { + GZ_PROFILE("rendering::SkyX::Update"); if (!mCreated || !this->mEnabled) { return; diff --git a/gazebo/rendering/skyx/src/VClouds/Lightning.cpp b/gazebo/rendering/skyx/src/VClouds/Lightning.cpp index 2361c7a830..7240b8f86c 100644 --- a/gazebo/rendering/skyx/src/VClouds/Lightning.cpp +++ b/gazebo/rendering/skyx/src/VClouds/Lightning.cpp @@ -3,7 +3,7 @@ This source file is part of SkyX. Visit http://www.paradise-studios.net/products/skyx/ -Copyright (C) 2009-2012 Xavier Verguín González +Copyright (C) 2009-2012 Xavier Verguín González This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -23,6 +23,7 @@ Place - Suite 330, Boston, MA 02111-1307, USA, or go to #include #include "VClouds/Lightning.h" +#include "gazebo/common/Profiler.hh" namespace SkyX { namespace VClouds { @@ -200,6 +201,7 @@ namespace SkyX { namespace VClouds void Lightning::update(Ogre::Real timeSinceLastFrame) { + GZ_PROFILE("rendering::Lightning::Update"); if (!mCreated) { return; diff --git a/gazebo/rendering/skyx/src/VCloudsManager.cpp b/gazebo/rendering/skyx/src/VCloudsManager.cpp index 3755946d40..a4c1f98bd4 100644 --- a/gazebo/rendering/skyx/src/VCloudsManager.cpp +++ b/gazebo/rendering/skyx/src/VCloudsManager.cpp @@ -3,7 +3,7 @@ This source file is part of SkyX. Visit http://www.paradise-studios.net/products/skyx/ -Copyright (C) 2009-2012 Xavier Verguín González +Copyright (C) 2009-2012 Xavier Verguín González This program is free software; you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free Software @@ -24,6 +24,7 @@ Place - Suite 330, Boston, MA 02111-1307, USA, or go to #include "VCloudsManager.h" #include "SkyX.h" +#include "gazebo/common/Profiler.hh" namespace SkyX { @@ -114,6 +115,7 @@ namespace SkyX void VCloudsManager::update(const Ogre::Real& timeSinceLastFrame) { + GZ_PROFILE("rendering::VCloudsManager::Update"); if (!mCreated) { return; diff --git a/gazebo/sensors/CameraSensor.cc b/gazebo/sensors/CameraSensor.cc index 1df3f77e24..8a8221bcfd 100644 --- a/gazebo/sensors/CameraSensor.cc +++ b/gazebo/sensors/CameraSensor.cc @@ -235,10 +235,13 @@ void CameraSensor::PrerenderEnded() ////////////////////////////////////////////////// void CameraSensor::Render() { + GZ_PROFILE("sensors::CameraSensor::Render"); if (this->useStrictRate) { if (!this->dataPtr->renderNeeded) + { return; + } // Update all the cameras this->camera->Render(); @@ -249,7 +252,9 @@ void CameraSensor::Render() else { if (!this->camera || !this->IsActive() || !this->NeedsUpdate()) + { return; + } // Update all the cameras this->camera->Render(); diff --git a/gazebo/sensors/GpuRaySensor.cc b/gazebo/sensors/GpuRaySensor.cc index 8775d2d31c..c1a7e7c8d1 100644 --- a/gazebo/sensors/GpuRaySensor.cc +++ b/gazebo/sensors/GpuRaySensor.cc @@ -603,10 +603,13 @@ void GpuRaySensor::PrerenderEnded() ////////////////////////////////////////////////// void GpuRaySensor::Render() { + GZ_PROFILE("sensors::GpuRaySensor::Render"); if (this->useStrictRate) { if (!this->dataPtr->renderNeeded) + { return; + } this->dataPtr->laserCam->Render(); this->dataPtr->rendered = true; @@ -615,7 +618,9 @@ void GpuRaySensor::Render() else { if (!this->dataPtr->laserCam || !this->IsActive() || !this->NeedsUpdate()) + { return; + } this->lastMeasurementTime = this->scene->SimTime(); diff --git a/gazebo/sensors/MultiCameraSensor.cc b/gazebo/sensors/MultiCameraSensor.cc index 9fc591e3d0..7cbddf079f 100644 --- a/gazebo/sensors/MultiCameraSensor.cc +++ b/gazebo/sensors/MultiCameraSensor.cc @@ -260,6 +260,7 @@ void MultiCameraSensor::PrerenderEnded() ////////////////////////////////////////////////// void MultiCameraSensor::Render() { + GZ_PROFILE("sensors::MultiCameraSensor::Render"); if (this->useStrictRate) { if (!this->dataPtr->renderNeeded) diff --git a/gazebo/server_main.cc b/gazebo/server_main.cc index ea5ea6bcf2..a0855e5b2a 100644 --- a/gazebo/server_main.cc +++ b/gazebo/server_main.cc @@ -24,6 +24,9 @@ ////////////////////////////////////////////////// int main(int argc, char **argv) { +#ifndef _WIN32 + ::setenv("RMT_PORT", "1500", true); +#endif std::unique_ptr server; try