$darkmode
Suckless OGL 1.0.0
A lean, high-performance C11 PBR Renderer
gpu_profiler.c File Reference
#include "gpu_profiler.h"
#include "adaptive_sampler.h"
#include "glad/glad.h"
#include "profiler.h"
#include "utils.h"
#include <stddef.h>
Include dependency graph for gpu_profiler.c:

Functions

void gpu_profiler_init (GPUProfiler *profiler)
 Initializes the GPU profiler. More...
 
void gpu_profiler_cleanup (GPUProfiler *profiler)
 Cleans up GPU resources. More...
 
void gpu_profiler_set_enabled (GPUProfiler *profiler, bool enabled)
 Enables or disables the profiler. More...
 
void gpu_profiler_begin_frame (GPUProfiler *profiler, uint64_t frame_index)
 Marks the beginning of a frame. Swaps buffers and processes previous results. More...
 
void gpu_profiler_start_stage (GPUProfiler *profiler, const char *name, uint32_t color)
 Starts a new profiling stage. More...
 
void gpu_profiler_end_stage (GPUProfiler *profiler)
 Ends the current profiling stage. More...
 
void gpu_profiler_reset_samplers (GPUProfiler *profiler, double current_time)
 Resets all samplers for a new capture window. More...
 

Variables

static const float SAMPLER_WINDOW_DURATION = GPU_PROFILER_WINDOW_DURATION_S
 
static const size_t SAMPLER_TARGET_SAMPLES = 120
 
static const float SAMPLER_INITIAL_GUESS_FPS = 60.0F
 
static const double NS_TO_MS = 1.0 / 1000000.0
 

Function Documentation

◆ gpu_profiler_begin_frame()

void gpu_profiler_begin_frame ( GPUProfiler profiler,
uint64_t  frame_index 
)

Marks the beginning of a frame. Swaps buffers and processes previous results.

Parameters
profilerPointer to the profiler.
frame_indexThe current frame index.
Here is the call graph for this function:

◆ gpu_profiler_cleanup()

void gpu_profiler_cleanup ( GPUProfiler profiler)

Cleans up GPU resources.

Parameters
profilerPointer to the profiler.
Here is the call graph for this function:

◆ gpu_profiler_end_stage()

void gpu_profiler_end_stage ( GPUProfiler profiler)

Ends the current profiling stage.

Parameters
profilerPointer to the profiler.
Here is the call graph for this function:

◆ gpu_profiler_init()

void gpu_profiler_init ( GPUProfiler profiler)

Initializes the GPU profiler.

Parameters
profilerPointer to the profiler.
Here is the call graph for this function:

◆ gpu_profiler_reset_samplers()

void gpu_profiler_reset_samplers ( GPUProfiler profiler,
double  current_time 
)

Resets all samplers for a new capture window.

Here is the call graph for this function:

◆ gpu_profiler_set_enabled()

void gpu_profiler_set_enabled ( GPUProfiler profiler,
bool  enabled 
)

Enables or disables the profiler.

Parameters
profilerPointer to the profiler.
enabledWhether to enable profiling.

◆ gpu_profiler_start_stage()

void gpu_profiler_start_stage ( GPUProfiler profiler,
const char *  name,
uint32_t  color 
)

Starts a new profiling stage.

Parameters
profilerPointer to the profiler.
nameName of the stage (must be persistent or copied).
colorHex color for visualization (e.g., 0xFF0000).
Here is the call graph for this function:

Variable Documentation

◆ NS_TO_MS

const double NS_TO_MS = 1.0 / 1000000.0
static

◆ SAMPLER_INITIAL_GUESS_FPS

const float SAMPLER_INITIAL_GUESS_FPS = 60.0F
static

◆ SAMPLER_TARGET_SAMPLES

const size_t SAMPLER_TARGET_SAMPLES = 120
static

◆ SAMPLER_WINDOW_DURATION

const float SAMPLER_WINDOW_DURATION = GPU_PROFILER_WINDOW_DURATION_S
static