mirror of
https://github.com/JulianGro/overte.git
synced 2025-05-07 12:39:55 +02:00
Improved NSIGHT instrumentation
* Application::idle, physics and avatar processing are tracked * Application::paintGL frameNumber payload is tracked * OpenGLDisplayPlugin::present is profiled with corresponding frameNumber payload * Added color and payload support to Nsight ProfileRange class.
This commit is contained in:
parent
0d046b12de
commit
225c462685
7 changed files with 62 additions and 16 deletions
|
@ -1401,7 +1401,7 @@ void Application::paintGL() {
|
||||||
_lastFramesPerSecondUpdate = now;
|
_lastFramesPerSecondUpdate = now;
|
||||||
}
|
}
|
||||||
|
|
||||||
PROFILE_RANGE(__FUNCTION__);
|
PROFILE_RANGE_EX(__FUNCTION__, 0xff0000ff, (uint64_t)_frameCount);
|
||||||
PerformanceTimer perfTimer("paintGL");
|
PerformanceTimer perfTimer("paintGL");
|
||||||
|
|
||||||
if (nullptr == _displayPlugin) {
|
if (nullptr == _displayPlugin) {
|
||||||
|
@ -2499,6 +2499,8 @@ static uint32_t _renderedFrameIndex { INVALID_FRAME };
|
||||||
|
|
||||||
void Application::idle(uint64_t now) {
|
void Application::idle(uint64_t now) {
|
||||||
|
|
||||||
|
PROFILE_RANGE(__FUNCTION__);
|
||||||
|
|
||||||
if (_aboutToQuit) {
|
if (_aboutToQuit) {
|
||||||
return; // bail early, nothing to do here.
|
return; // bail early, nothing to do here.
|
||||||
}
|
}
|
||||||
|
@ -2556,7 +2558,6 @@ void Application::idle(uint64_t now) {
|
||||||
_lastTimeUpdated.start();
|
_lastTimeUpdated.start();
|
||||||
|
|
||||||
{
|
{
|
||||||
PROFILE_RANGE(__FUNCTION__);
|
|
||||||
static uint64_t lastIdleStart{ now };
|
static uint64_t lastIdleStart{ now };
|
||||||
uint64_t idleStartToStartDuration = now - lastIdleStart;
|
uint64_t idleStartToStartDuration = now - lastIdleStart;
|
||||||
if (idleStartToStartDuration != 0) {
|
if (idleStartToStartDuration != 0) {
|
||||||
|
@ -3173,6 +3174,9 @@ void Application::updateDialogs(float deltaTime) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void Application::update(float deltaTime) {
|
void Application::update(float deltaTime) {
|
||||||
|
|
||||||
|
PROFILE_RANGE_EX(__FUNCTION__, 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
|
|
||||||
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
bool showWarnings = Menu::getInstance()->isOptionChecked(MenuOption::PipelineWarnings);
|
||||||
PerformanceWarning warn(showWarnings, "Application::update()");
|
PerformanceWarning warn(showWarnings, "Application::update()");
|
||||||
|
|
||||||
|
@ -3269,6 +3273,8 @@ void Application::update(float deltaTime) {
|
||||||
updateDialogs(deltaTime); // update various stats dialogs if present
|
updateDialogs(deltaTime); // update various stats dialogs if present
|
||||||
|
|
||||||
if (_physicsEnabled) {
|
if (_physicsEnabled) {
|
||||||
|
PROFILE_RANGE_EX("Physics", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
|
|
||||||
PerformanceTimer perfTimer("physics");
|
PerformanceTimer perfTimer("physics");
|
||||||
AvatarManager* avatarManager = DependencyManager::get<AvatarManager>().data();
|
AvatarManager* avatarManager = DependencyManager::get<AvatarManager>().data();
|
||||||
|
|
||||||
|
@ -3339,9 +3345,13 @@ void Application::update(float deltaTime) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
_avatarUpdate->synchronousProcess();
|
{
|
||||||
|
PROFILE_RANGE_EX("Avatars", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
|
_avatarUpdate->synchronousProcess();
|
||||||
|
}
|
||||||
|
|
||||||
{
|
{
|
||||||
|
PROFILE_RANGE_EX("Overlays", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
PerformanceTimer perfTimer("overlays");
|
PerformanceTimer perfTimer("overlays");
|
||||||
_overlays.update(deltaTime);
|
_overlays.update(deltaTime);
|
||||||
}
|
}
|
||||||
|
@ -3361,6 +3371,7 @@ void Application::update(float deltaTime) {
|
||||||
|
|
||||||
// Update my voxel servers with my current voxel query...
|
// Update my voxel servers with my current voxel query...
|
||||||
{
|
{
|
||||||
|
PROFILE_RANGE_EX("QueryOctree", 0xffff0000, (uint64_t)getActiveDisplayPlugin()->presentCount());
|
||||||
PerformanceTimer perfTimer("queryOctree");
|
PerformanceTimer perfTimer("queryOctree");
|
||||||
quint64 sinceLastQuery = now - _lastQueriedTime;
|
quint64 sinceLastQuery = now - _lastQueriedTime;
|
||||||
const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND;
|
const quint64 TOO_LONG_SINCE_LAST_QUERY = 3 * USECS_PER_SECOND;
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <gl/GLWidget.h>
|
#include <gl/GLWidget.h>
|
||||||
#include <NumericalConstants.h>
|
#include <NumericalConstants.h>
|
||||||
#include <DependencyManager.h>
|
#include <DependencyManager.h>
|
||||||
|
#include <shared/NsightHelpers.h>
|
||||||
#include <plugins/PluginContainer.h>
|
#include <plugins/PluginContainer.h>
|
||||||
#include <gl/Config.h>
|
#include <gl/Config.h>
|
||||||
#include <gl/GLEscrow.h>
|
#include <gl/GLEscrow.h>
|
||||||
|
@ -527,6 +527,9 @@ void OpenGLDisplayPlugin::internalPresent() {
|
||||||
|
|
||||||
void OpenGLDisplayPlugin::present() {
|
void OpenGLDisplayPlugin::present() {
|
||||||
incrementPresentCount();
|
incrementPresentCount();
|
||||||
|
|
||||||
|
PROFILE_RANGE_EX(__FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
|
||||||
|
|
||||||
updateTextures();
|
updateTextures();
|
||||||
if (_currentSceneTexture) {
|
if (_currentSceneTexture) {
|
||||||
// Write all layers to a local framebuffer
|
// Write all layers to a local framebuffer
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
#include <gpu/GLBackend.h>
|
#include <gpu/GLBackend.h>
|
||||||
#include <CursorManager.h>
|
#include <CursorManager.h>
|
||||||
#include <gl/GLWidget.h>
|
#include <gl/GLWidget.h>
|
||||||
|
#include <shared/NsightHelpers.h>
|
||||||
|
|
||||||
#include "../Logging.h"
|
#include "../Logging.h"
|
||||||
#include "../CompositorHelper.h"
|
#include "../CompositorHelper.h"
|
||||||
|
@ -106,6 +107,9 @@ void HmdDisplayPlugin::compositePointer() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void HmdDisplayPlugin::internalPresent() {
|
void HmdDisplayPlugin::internalPresent() {
|
||||||
|
|
||||||
|
PROFILE_RANGE_EX(__FUNCTION__, 0xff00ff00, (uint64_t)presentCount())
|
||||||
|
|
||||||
// Composite together the scene, overlay and mouse cursor
|
// Composite together the scene, overlay and mouse cursor
|
||||||
hmdPresent();
|
hmdPresent();
|
||||||
|
|
||||||
|
|
|
@ -15,8 +15,27 @@ ProfileRange::ProfileRange(const char *name) {
|
||||||
nvtxRangePush(name);
|
nvtxRangePush(name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ProfileRange::ProfileRange(const char *name, uint32_t argbColor, uint64_t payload) {
|
||||||
|
|
||||||
|
nvtxEventAttributes_t eventAttrib = {0};
|
||||||
|
eventAttrib.version = NVTX_VERSION;
|
||||||
|
eventAttrib.size = NVTX_EVENT_ATTRIB_STRUCT_SIZE;
|
||||||
|
eventAttrib.colorType = NVTX_COLOR_ARGB;
|
||||||
|
eventAttrib.color = argbColor;
|
||||||
|
eventAttrib.messageType = NVTX_MESSAGE_TYPE_ASCII;
|
||||||
|
eventAttrib.message.ascii = name;
|
||||||
|
eventAttrib.payload.llValue = payload;
|
||||||
|
eventAttrib.payloadType = NVTX_PAYLOAD_TYPE_UNSIGNED_INT64;
|
||||||
|
|
||||||
|
nvtxRangePushEx(&eventAttrib);
|
||||||
|
}
|
||||||
|
|
||||||
ProfileRange::~ProfileRange() {
|
ProfileRange::~ProfileRange() {
|
||||||
nvtxRangePop();
|
nvtxRangePop();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#else
|
||||||
|
ProfileRange::ProfileRange(const char *name) {}
|
||||||
|
ProfileRange::ProfileRange(const char *name, uint32_t argbColor, uint64_t payload) {}
|
||||||
|
ProfileRange::~ProfileRange() {}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -9,16 +9,16 @@
|
||||||
#ifndef hifi_gl_NsightHelpers_h
|
#ifndef hifi_gl_NsightHelpers_h
|
||||||
#define hifi_gl_NsightHelpers_h
|
#define hifi_gl_NsightHelpers_h
|
||||||
|
|
||||||
#if defined(NSIGHT_FOUND)
|
#include <stdint.h>
|
||||||
class ProfileRange {
|
|
||||||
public:
|
class ProfileRange {
|
||||||
ProfileRange(const char *name);
|
public:
|
||||||
~ProfileRange();
|
ProfileRange(const char *name);
|
||||||
};
|
ProfileRange(const char *name, uint32_t argbColor, uint64_t payload);
|
||||||
|
~ProfileRange();
|
||||||
|
};
|
||||||
|
|
||||||
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
#define PROFILE_RANGE(name) ProfileRange profileRangeThis(name);
|
||||||
#else
|
#define PROFILE_RANGE_EX(name, argbColor, payload) ProfileRange profileRangeThis(name, argbColor, payload);
|
||||||
#define PROFILE_RANGE(name)
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#endif
|
|
|
@ -6,6 +6,7 @@
|
||||||
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
// See the accompanying file LICENSE or http://www.apache.org/licenses/LICENSE-2.0.html
|
||||||
//
|
//
|
||||||
#include "OculusDisplayPlugin.h"
|
#include "OculusDisplayPlugin.h"
|
||||||
|
#include <shared/NsightHelpers.h>
|
||||||
#include "OculusHelpers.h"
|
#include "OculusHelpers.h"
|
||||||
|
|
||||||
const QString OculusDisplayPlugin::NAME("Oculus Rift");
|
const QString OculusDisplayPlugin::NAME("Oculus Rift");
|
||||||
|
@ -54,6 +55,9 @@ void OculusDisplayPlugin::updateFrameData() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OculusDisplayPlugin::hmdPresent() {
|
void OculusDisplayPlugin::hmdPresent() {
|
||||||
|
|
||||||
|
PROFILE_RANGE_EX(__FUNCTION__, 0xff00ff00, (uint64_t)_currentRenderFrameIndex)
|
||||||
|
|
||||||
if (!_currentSceneTexture) {
|
if (!_currentSceneTexture) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -21,7 +21,7 @@
|
||||||
#include <PerfStat.h>
|
#include <PerfStat.h>
|
||||||
#include <plugins/PluginContainer.h>
|
#include <plugins/PluginContainer.h>
|
||||||
#include <ViewFrustum.h>
|
#include <ViewFrustum.h>
|
||||||
|
#include <shared/NsightHelpers.h>
|
||||||
#include "OpenVrHelpers.h"
|
#include "OpenVrHelpers.h"
|
||||||
|
|
||||||
Q_DECLARE_LOGGING_CATEGORY(displayplugins)
|
Q_DECLARE_LOGGING_CATEGORY(displayplugins)
|
||||||
|
@ -144,6 +144,9 @@ void OpenVrDisplayPlugin::updateHeadPose(uint32_t frameIndex) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenVrDisplayPlugin::hmdPresent() {
|
void OpenVrDisplayPlugin::hmdPresent() {
|
||||||
|
|
||||||
|
PROFILE_RANGE_EX(__FUNCTION__, 0xff00ff00, (uint64_t)_currentRenderFrameIndex)
|
||||||
|
|
||||||
// Flip y-axis since GL UV coords are backwards.
|
// Flip y-axis since GL UV coords are backwards.
|
||||||
static vr::VRTextureBounds_t leftBounds{ 0, 0, 0.5f, 1 };
|
static vr::VRTextureBounds_t leftBounds{ 0, 0, 0.5f, 1 };
|
||||||
static vr::VRTextureBounds_t rightBounds{ 0.5f, 0, 1, 1 };
|
static vr::VRTextureBounds_t rightBounds{ 0.5f, 0, 1, 1 };
|
||||||
|
@ -155,6 +158,8 @@ void OpenVrDisplayPlugin::hmdPresent() {
|
||||||
}
|
}
|
||||||
|
|
||||||
void OpenVrDisplayPlugin::postPreview() {
|
void OpenVrDisplayPlugin::postPreview() {
|
||||||
|
PROFILE_RANGE_EX(__FUNCTION__, 0xff00ff00, (uint64_t)_currentRenderFrameIndex)
|
||||||
|
|
||||||
vr::TrackedDevicePose_t currentTrackedDevicePose[vr::k_unMaxTrackedDeviceCount];
|
vr::TrackedDevicePose_t currentTrackedDevicePose[vr::k_unMaxTrackedDeviceCount];
|
||||||
_compositor->WaitGetPoses(currentTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
|
_compositor->WaitGetPoses(currentTrackedDevicePose, vr::k_unMaxTrackedDeviceCount, nullptr, 0);
|
||||||
_hmdActivityLevel = _system->GetTrackedDeviceActivityLevel(vr::k_unTrackedDeviceIndex_Hmd);
|
_hmdActivityLevel = _system->GetTrackedDeviceActivityLevel(vr::k_unTrackedDeviceIndex_Hmd);
|
||||||
|
|
Loading…
Reference in a new issue