Exposed a few more internal performats stats.

This commit is contained in:
Branimir Karadžić 2016-12-19 17:18:07 -08:00
parent c35d3c2d6f
commit 5a0d824331
8 changed files with 69 additions and 43 deletions

View File

@ -709,22 +709,26 @@ namespace bgfx
///
struct Stats
{
uint64_t cpuTimeBegin; //!< CPU frame begin time.
uint64_t cpuTimeEnd; //!< CPU frame end time.
uint64_t cpuTimerFreq; //!< CPU timer frequency.
uint64_t cpuTimeBegin; //!< CPU frame begin time.
uint64_t cpuTimeEnd; //!< CPU frame end time.
uint64_t cpuTimerFreq; //!< CPU timer frequency.
uint64_t gpuTimeBegin; //!< GPU frame begin time.
uint64_t gpuTimeEnd; //!< GPU frame end time.
uint64_t gpuTimerFreq; //!< GPU timer frequency.
uint64_t gpuTimeBegin; //!< GPU frame begin time.
uint64_t gpuTimeEnd; //!< GPU frame end time.
uint64_t gpuTimerFreq; //!< GPU timer frequency.
int64_t waitRender; //!< Time spent waiting for render backend thread to finish issuing
//! draw commands to underlying graphics API.
int64_t waitSubmit; //!< Time spent waiting for submit thread to advance to next frame.
int64_t waitRender; //!< Time spent waiting for render backend thread to finish issuing
//! draw commands to underlying graphics API.
int64_t waitSubmit; //!< Time spent waiting for submit thread to advance to next frame.
uint16_t width; //!< Backbuffer width in pixels.
uint16_t height; //!< Backbuffer height in pixels.
uint16_t textWidth; //!< Debug text width in characters.
uint16_t textHeight; //!< Debug text height in characters.
uint32_t numDraw; //!< Number of draw calls submitted.
uint32_t numCompute; //!< Number of compute calls submitted.
uint32_t maxGpuLatency; //!< GPU driver latency.
uint16_t width; //!< Backbuffer width in pixels.
uint16_t height; //!< Backbuffer height in pixels.
uint16_t textWidth; //!< Debug text width in characters.
uint16_t textHeight; //!< Debug text height in characters.
};
/// Vertex declaration.

View File

@ -330,6 +330,10 @@ typedef struct bgfx_stats
int64_t waitRender;
int64_t waitSubmit;
uint32_t numDraw;
uint32_t numCompute;
uint32_t maxGpuLatency;
uint16_t width;
uint16_t height;
uint16_t textWidth;

View File

@ -6182,11 +6182,14 @@ BX_PRAGMA_DIAGNOSTIC_POP();
const int64_t timerFreq = bx::getHPFrequency();
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.numDraw = statsKeyType[0];
perfStats.numCompute = statsKeyType[1];
perfStats.maxGpuLatency = maxGpuLatency;
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{

View File

@ -5480,11 +5480,14 @@ data.NumQualityLevels = 0;
const int64_t timerFreq = bx::getHPFrequency();
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.numDraw = statsKeyType[0];
perfStats.numCompute = statsKeyType[1];
perfStats.maxGpuLatency = maxGpuLatency;
if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
{

View File

@ -4259,11 +4259,14 @@ namespace bgfx { namespace d3d9
const int64_t timerFreq = bx::getHPFrequency();
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.numDraw = statsKeyType[0];
perfStats.numCompute = statsKeyType[1];
perfStats.maxGpuLatency = maxGpuLatency;
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{

View File

@ -7309,11 +7309,14 @@ namespace bgfx { namespace gl
const int64_t timerFreq = bx::getHPFrequency();
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = 1000000000;
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = 1000000000;
perfStats.numDraw = statsKeyType[0];
perfStats.numCompute = statsKeyType[1];
perfStats.maxGpuLatency = maxGpuLatency;
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )
{

View File

@ -3750,11 +3750,14 @@ namespace bgfx { namespace mtl
const int64_t timerFreq = bx::getHPFrequency();
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
perfStats.gpuTimeEnd = m_gpuTimer.m_end;
perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.numDraw = statsKeyType[0];
perfStats.numCompute = statsKeyType[1];
perfStats.maxGpuLatency = maxGpuLatency;
rce.setTriangleFillMode(MTLTriangleFillModeFill);
if (_render->m_debug & (BGFX_DEBUG_IFH|BGFX_DEBUG_STATS) )

View File

@ -4425,11 +4425,14 @@ BX_UNUSED(presentMin, presentMax);
const int64_t timerFreq = bx::getHPFrequency();
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
// perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
// perfStats.gpuTimeEnd = m_gpuTimer.m_end;
// perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
perfStats.cpuTimeEnd = now;
perfStats.cpuTimerFreq = timerFreq;
// perfStats.gpuTimeBegin = m_gpuTimer.m_begin;
// perfStats.gpuTimeEnd = m_gpuTimer.m_end;
// perfStats.gpuTimerFreq = m_gpuTimer.m_frequency;
// perfStats.numDraw = statsKeyType[0];
// perfStats.numCompute = statsKeyType[1];
// perfStats.maxGpuLatency = maxGpuLatency;
if (_render->m_debug & (BGFX_DEBUG_IFH | BGFX_DEBUG_STATS) )
{