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

Functions

static void format_missed_frames (const AdaptiveSampler *sampler, char *buffer, size_t size)
 
static void format_relative_percentages (const GPUProfiler *profiler, int stage_index, float current_avg_ms, char *buffer, size_t size)
 
static void build_ascii_bar (char *bar, size_t bar_size, int start_char, int width_char, char symbol, bool is_root)
 
static void log_ascii_timeline (const GPUProfiler *profiler)
 
static void log_gpu_stage (const char *stage_name, float avg_ms, const char *details, const char *percentages, int depth)
 
bool app_metrics_log_gpu_stats (GPUProfiler *profiler, double current_time, bool should_log)
 Logs GPU performance statistics if the reporting window for any stage has elapsed. More...
 

Function Documentation

◆ app_metrics_log_gpu_stats()

bool app_metrics_log_gpu_stats ( GPUProfiler profiler,
double  current_time,
bool  should_log 
)

Logs GPU performance statistics if the reporting window for any stage has elapsed.

This function handles the logic of checking sampling windows, calculating missed frames, formatting the output string, and logging the results via the logging system. It also resets samplers after reporting.

Parameters
profilerPointer to the GPUProfiler containing the stages and samplers.
current_timeThe current application time (e.g. from glfwGetTime()).
should_logIf true, force printing even if interval not elapsed.
Returns
true if logs were printed (2s interval elapsed), false otherwise.
Here is the call graph for this function:

◆ build_ascii_bar()

static void build_ascii_bar ( char *  bar,
size_t  bar_size,
int  start_char,
int  width_char,
char  symbol,
bool  is_root 
)
static

◆ format_missed_frames()

static void format_missed_frames ( const AdaptiveSampler sampler,
char *  buffer,
size_t  size 
)
static
Here is the call graph for this function:

◆ format_relative_percentages()

static void format_relative_percentages ( const GPUProfiler profiler,
int  stage_index,
float  current_avg_ms,
char *  buffer,
size_t  size 
)
static
Here is the call graph for this function:

◆ log_ascii_timeline()

static void log_ascii_timeline ( const GPUProfiler profiler)
static
Here is the call graph for this function:

◆ log_gpu_stage()

static void log_gpu_stage ( const char *  stage_name,
float  avg_ms,
const char *  details,
const char *  percentages,
int  depth 
)
static