GPU Timers

GPUTimer m_timer;
/* Timer Creation */
Chrono::Create(&m_timer);

/* Timer Usage */
Chrono::Start(m_timer);
{
    Pipeline::Activate(m_prog);
    ShaderStage::SetUniformMat4f(m_vert,1,Camera::View(&m_camera));
    ShaderStage::SetUniformMat4f(m_vert,2,Camera::Proj(&m_camera));
    Scene::Render(m_scene,&m_vert,0);
}
Chrono::Stop(m_timer);

/* Display */
ImGui::Text("Render time : %2.3lf ms", Chrono::ElapsedTime(m_timer));

Chrono API Description

struct GPUTimer

GPU Timer Query Ressource.

Public Members

double result = 0.0

Measured gpu elapsed time

uint32_t start = 0u

OpenGL start query ID

uint32_t stop = 0u

OpenGL stop query ID

namespace Chrono

Functions

void Create(GPUTimer *t)

Creates a gpu timer object.

void Destroy(GPUTimer *t)

Cleans up a gpu timer object.

void Start(const GPUTimer &t)

Starts the gpu timer object.

void Stop(const GPUTimer &t)

Stops the gpu timer object.

double ElapsedTime(const GPUTimer &t)

Compute the gpu elapsed time.