27 #define MAX_TIMER_NAME 32
28 #define MAX_NESTED_TIMER 8
29 #define MIM_RANGE_LEN 8
30 #define GPU_TIMER_FALLOFF 0.1
64 if (
G.debug_value > 20 &&
G.debug_value < 30) {
105 if (timer->
query[0] == 0) {
153 "You forgot a DRW_stats_group/query_end somewhere!");
155 "You forgot a DRW_stats_group/query_start somewhere!");
169 if (timer->
query[0] != 0) {
182 lvl_time[timer->
lvl + 1] = 0;
195 rect->
ymax - (3 +
v) *
U.widget_unit,
204 rect->
xmin + (1 + u) *
U.widget_unit, rect->
ymax - (3 +
v) *
U.widget_unit, 0.0f, txt,
size);
209 char stat_string[64];
213 double init_tot_time = 0.0, background_tot_time = 0.0, render_tot_time = 0.0, tot_time = 0.0;
218 BLF_shadow(fontid, 5, (
const float[4]){0.0f, 0.0f, 0.0f, 0.75f});
228 sprintf(col_label,
"Engine");
230 sprintf(col_label,
"Init");
232 sprintf(col_label,
"Background");
234 sprintf(col_label,
"Render");
236 sprintf(col_label,
"Total (w/o cache)");
241 char time_to_txt[16];
247 init_tot_time +=
data->init_time;
248 sprintf(time_to_txt,
"%.2fms",
data->init_time);
251 background_tot_time +=
data->background_time;
252 sprintf(time_to_txt,
"%.2fms",
data->background_time);
255 render_tot_time +=
data->render_time;
256 sprintf(time_to_txt,
"%.2fms",
data->render_time);
259 tot_time +=
data->init_time +
data->background_time +
data->render_time;
260 sprintf(time_to_txt,
"%.2fms",
data->init_time +
data->background_time +
data->render_time);
267 sprintf(col_label,
"Sub Total");
269 sprintf(time_to_txt,
"%.2fms", init_tot_time);
271 sprintf(time_to_txt,
"%.2fms", background_tot_time);
273 sprintf(time_to_txt,
"%.2fms", render_tot_time);
275 sprintf(time_to_txt,
"%.2fms", tot_time);
281 sprintf(col_label,
"Cache Time");
283 sprintf(time_to_txt,
"%.2fms", *cache_time);
295 sprintf(stat_string,
"GPU Memory");
296 draw_stat(rect, 0,
v, stat_string,
sizeof(stat_string));
297 sprintf(stat_string,
"%.2fMB", (
double)(tex_mem + vbo_mem) / 1000000.0);
299 sprintf(stat_string,
"Textures");
300 draw_stat(rect, 1,
v, stat_string,
sizeof(stat_string));
301 sprintf(stat_string,
"%.2fMB", (
double)tex_mem / 1000000.0);
303 sprintf(stat_string,
"Meshes");
304 draw_stat(rect, 1,
v, stat_string,
sizeof(stat_string));
305 sprintf(stat_string,
"%.2fMB", (
double)vbo_mem / 1000000.0);
310 BLI_strncpy(stat_string,
"GPU Render Timings",
sizeof(stat_string));
311 draw_stat(rect, 0,
v++, stat_string,
sizeof(stat_string));
314 double time_ms, time_percent;
319 if ((
G.debug_value - 21) < timer->
lvl) {
324 lvl_index[timer->
lvl] = i;
328 if (timer_parent !=
NULL) {
332 time_percent = 100.0;
336 time_ms =
MIN2(time_ms, 999.0);
337 time_percent =
MIN2(time_percent, 100.0);
340 draw_stat(rect, 0 + timer->
lvl,
v, stat_string,
sizeof(stat_string));
341 BLI_snprintf(stat_string,
sizeof(stat_string),
"%.2fms", time_ms);
342 draw_stat(rect, 12 + timer->
lvl,
v, stat_string,
sizeof(stat_string));
343 BLI_snprintf(stat_string,
sizeof(stat_string),
"%.0f", time_percent);
344 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_batch_draw_begin(void)
void BLF_enable(int fontid, int option)
void BLF_batch_draw_end(void)
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
char * BLI_strncpy(char *__restrict dst, const char *__restrict src, size_t maxncpy) ATTR_NONNULL()
size_t BLI_snprintf(char *__restrict dst, size_t maxncpy, const char *__restrict format,...) ATTR_NONNULL(1
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)
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_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)
double * DRW_view_data_cache_time_get(DRWViewData *view_data)
#define DRW_ENABLED_ENGINE_ITER(view_data_, engine_, data_)
void(* MEM_freeN)(void *vmemh)
void *(* MEM_callocN)(size_t len, const char *str)
unsigned __int64 uint64_t
struct DRWViewData * view_data_active
char name[MAX_TIMER_NAME]