30#define MAX_TIMER_NAME 32
31#define MAX_NESTED_TIMER 8
32#define MIM_RANGE_LEN 8
33#define GPU_TIMER_FALLOFF 0.1
67 if (
G.debug_value > 20 &&
G.debug_value < 30) {
105 timer->is_query = is_query;
109 if (
timer->is_query) {
110 if (
timer->query[0] == 0) {
158 "You forgot a DRW_stats_group/query_end somewhere!");
160 "You forgot a DRW_stats_group/query_start somewhere!");
172 if (
timer->is_query) {
174 if (
timer->query[0] != 0) {
186 timer->time_average = lvl_time[
timer->lvl + 1];
187 lvl_time[
timer->lvl + 1] = 0;
200 rect->
ymax - (3 +
v) *
U.widget_unit,
206static void draw_stat(
const rcti *rect,
int u,
int v,
const char *txt,
const int size)
209 rect->
xmin + (1 + u) *
U.widget_unit, rect->
ymax - (3 +
v) *
U.widget_unit, 0.0f, txt, size);
214 char stat_string[64];
218 double init_tot_time = 0.0, background_tot_time = 0.0, render_tot_time = 0.0, tot_time = 0.0;
233 STRNCPY(col_label,
"Background");
237 STRNCPY(col_label,
"Total (w/o cache)");
242 char time_to_txt[16];
248 init_tot_time += data->init_time;
249 SNPRINTF(time_to_txt,
"%.2fms", data->init_time);
252 background_tot_time += data->background_time;
253 SNPRINTF(time_to_txt,
"%.2fms", data->background_time);
256 render_tot_time += data->render_time;
257 SNPRINTF(time_to_txt,
"%.2fms", data->render_time);
260 tot_time += data->init_time + data->background_time + data->render_time;
261 SNPRINTF(time_to_txt,
"%.2fms", data->init_time + data->background_time + data->render_time);
268 STRNCPY(col_label,
"Sub Total");
270 SNPRINTF(time_to_txt,
"%.2fms", init_tot_time);
272 SNPRINTF(time_to_txt,
"%.2fms", background_tot_time);
274 SNPRINTF(time_to_txt,
"%.2fms", render_tot_time);
276 SNPRINTF(time_to_txt,
"%.2fms", tot_time);
282 STRNCPY(col_label,
"Cache Time");
284 SNPRINTF(time_to_txt,
"%.2fms", *cache_time);
296 STRNCPY(stat_string,
"GPU Memory");
297 draw_stat(rect, 0,
v, stat_string,
sizeof(stat_string));
298 SNPRINTF(stat_string,
"%.2fMB",
double(tex_mem + vbo_mem) / 1000000.0);
300 STRNCPY(stat_string,
"Textures");
301 draw_stat(rect, 1,
v, stat_string,
sizeof(stat_string));
302 SNPRINTF(stat_string,
"%.2fMB",
double(tex_mem) / 1000000.0);
304 STRNCPY(stat_string,
"Meshes");
305 draw_stat(rect, 1,
v, stat_string,
sizeof(stat_string));
306 SNPRINTF(stat_string,
"%.2fMB",
double(vbo_mem) / 1000000.0);
311 STRNCPY(stat_string,
"GPU Render Timings");
312 draw_stat(rect, 0,
v++, stat_string,
sizeof(stat_string));
315 double time_ms, time_percent;
320 if ((
G.debug_value - 21) <
timer->lvl) {
325 lvl_index[
timer->lvl] = i;
327 time_ms =
timer->time_average / 1000000.0;
329 if (timer_parent !=
nullptr) {
333 time_percent = 100.0;
337 time_ms = std::min(time_ms, 999.0);
338 time_percent = std::min(time_percent, 100.0);
342 SNPRINTF(stat_string,
"%.2fms", time_ms);
344 SNPRINTF(stat_string,
"%.0f", time_percent);
void BLF_batch_draw_begin()
void BLF_batch_draw_end()
void BLF_draw_default(float x, float y, float z, const char *str, size_t str_len) ATTR_NONNULL()
#define BLI_assert_msg(a, msg)
#define STRNCPY(dst, src)
#define SNPRINTF(dst, format,...)
typedef double(DMatrix)[4][4]
void GPU_debug_group_end()
void GPU_debug_group_begin(const char *name)
unsigned int GPU_texture_memory_usage_get()
uint GPU_vertbuf_get_memory_usage()
Read Guarded memory(de)allocation.
#define MEM_recallocN(vmemh, len)
void UI_FontThemeColor(int fontid, int colorid)
ATTR_WARN_UNUSED_RESULT const BMVert * v
void DRW_stats_group_start(const char *name)
void DRW_stats_query_start(const char *name)
static struct DRWTimerPool DTP
void DRW_stats_group_end()
void DRW_stats_draw(const rcti *rect)
static DRWTimer * drw_stats_timer_get()
static void drw_stats_timer_start_ex(const char *name, const bool is_query)
void DRW_stats_query_end()
#define GPU_TIMER_FALLOFF
static void draw_stat_5row(const rcti *rect, int u, int v, const char *txt, const int size)
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
DRWViewData * view_data_active