42 #define MAX_TIMER_NAME 32
43 #define MAX_NESTED_TIMER 8
45 #define GPU_TIMER_FALLOFF 0.1
79 if (
G.debug_value > 20 &&
G.debug_value < 30) {
120 if (timer->
query[0] == 0) {
171 "You forgot a DRW_stats_group/query_end somewhere!");
173 "You forgot a DRW_stats_group/query_start somewhere!");
187 if (timer->
query[0] != 0) {
200 lvl_time[timer->
lvl + 1] = 0;
213 rect->
ymax - (3 +
v) *
U.widget_unit,
222 rect->
xmin + (1 + u) *
U.widget_unit, rect->
ymax - (3 +
v) *
U.widget_unit, 0.0f, txt,
size);
227 char stat_string[64];
231 double init_tot_time = 0.0, background_tot_time = 0.0, render_tot_time = 0.0, tot_time = 0.0;
236 BLF_shadow(fontid, 5, (
const float[4]){0.0f, 0.0f, 0.0f, 0.75f});
246 sprintf(col_label,
"Engine");
248 sprintf(col_label,
"Init");
250 sprintf(col_label,
"Background");
252 sprintf(col_label,
"Render");
254 sprintf(col_label,
"Total (w/o cache)");
259 char time_to_txt[16];
267 init_tot_time +=
data->init_time;
268 sprintf(time_to_txt,
"%.2fms",
data->init_time);
271 background_tot_time +=
data->background_time;
272 sprintf(time_to_txt,
"%.2fms",
data->background_time);
275 render_tot_time +=
data->render_time;
276 sprintf(time_to_txt,
"%.2fms",
data->render_time);
279 tot_time +=
data->init_time +
data->background_time +
data->render_time;
280 sprintf(time_to_txt,
"%.2fms",
data->init_time +
data->background_time +
data->render_time);
287 sprintf(col_label,
"Sub Total");
289 sprintf(time_to_txt,
"%.2fms", init_tot_time);
291 sprintf(time_to_txt,
"%.2fms", background_tot_time);
293 sprintf(time_to_txt,
"%.2fms", render_tot_time);
295 sprintf(time_to_txt,
"%.2fms", tot_time);
301 sprintf(col_label,
"Cache Time");
303 sprintf(time_to_txt,
"%.2fms", *cache_time);
315 sprintf(stat_string,
"GPU Memory");
316 draw_stat(rect, 0,
v, stat_string,
sizeof(stat_string));
317 sprintf(stat_string,
"%.2fMB", (
double)(tex_mem + vbo_mem) / 1000000.0);
319 sprintf(stat_string,
"Textures");
320 draw_stat(rect, 1,
v, stat_string,
sizeof(stat_string));
321 sprintf(stat_string,
"%.2fMB", (
double)tex_mem / 1000000.0);
323 sprintf(stat_string,
"Meshes");
324 draw_stat(rect, 1,
v, stat_string,
sizeof(stat_string));
325 sprintf(stat_string,
"%.2fMB", (
double)vbo_mem / 1000000.0);
330 BLI_strncpy(stat_string,
"GPU Render Timings",
sizeof(stat_string));
331 draw_stat(rect, 0,
v++, stat_string,
sizeof(stat_string));
334 double time_ms, time_percent;
339 if ((
G.debug_value - 21) < timer->
lvl) {
344 lvl_index[timer->
lvl] = i;
348 if (timer_parent !=
NULL) {
352 time_percent = 100.0;
356 time_ms =
MIN2(time_ms, 999.0);
357 time_percent =
MIN2(time_percent, 100.0);
360 draw_stat(rect, 0 + timer->
lvl,
v, stat_string,
sizeof(stat_string));
361 BLI_snprintf(stat_string,
sizeof(stat_string),
"%.2fms", time_ms);
362 draw_stat(rect, 12 + timer->
lvl,
v, stat_string,
sizeof(stat_string));
363 BLI_snprintf(stat_string,
sizeof(stat_string),
"%.0f", time_percent);
364 draw_stat(rect, 16 + timer->
lvl,
v, stat_string,
sizeof(stat_string));
void BLF_shadow_offset(int fontid, int x, int y)
void BLF_shadow(int fontid, int level, const float rgba[4]) ATTR_NONNULL(3)
void BLF_disable(int fontid, int option)
void BLF_draw_default_ascii(float x, float y, float z, const char *str, size_t len) ATTR_NONNULL()
void BLF_batch_draw_begin(void)
void BLF_enable(int fontid, int option)
void BLF_batch_draw_end(void)
#define LISTBASE_FOREACH(type, var, list)
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, const size_t maxncpy) ATTR_NONNULL()
typedef double(DMatrix)[4][4]
void GPU_debug_group_end(void)
void GPU_debug_group_begin(const char *name)
unsigned int GPU_texture_memory_usage_get(void)
uint GPU_vertbuf_get_memory_usage(void)
double * GPU_viewport_cache_time_get(GPUViewport *viewport)
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
void UI_FontThemeColor(int fontid, int colorid)
ATTR_WARN_UNUSED_RESULT const BMVert * v
static DBVT_INLINE btScalar size(const btDbvtVolume &a)
void * drw_viewport_engine_data_ensure(void *engine_type)
void DRW_stats_query_end(void)
void DRW_stats_begin(void)
void DRW_stats_group_start(const char *name)
void DRW_stats_query_start(const char *name)
static struct DRWTimerPool DTP
void DRW_stats_reset(void)
void DRW_stats_draw(const rcti *rect)
static void drw_stats_timer_start_ex(const char *name, const bool is_query)
static DRWTimer * drw_stats_timer_get(void)
#define GPU_TIMER_FALLOFF
void DRW_stats_group_end(void)
static void draw_stat_5row(const rcti *rect, int u, int v, const char *txt, const int size)
void DRW_stats_free(void)
static void draw_stat(const rcti *rect, int u, int v, const char *txt, const int size)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
unsigned __int64 uint64_t
char name[MAX_TIMER_NAME]