MCPcopy Create free account
hub / github.com/Redot-Engine/redot-engine / _update_frame

Method _update_frame

editor/debugger/editor_visual_profiler.cpp:337–425  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

335}
336
337void EditorVisualProfiler::_update_frame(bool p_focus_selected) {
338 int cursor_metric = _get_cursor_index();
339
340 Ref<Texture> track_icon = get_editor_theme_icon(SNAME("TrackColor"));
341
342 ERR_FAIL_INDEX(cursor_metric, frame_metrics.size());
343
344 updating_frame = true;
345 variables->clear();
346
347 TreeItem *root = variables->create_item();
348 const Metric &m = frame_metrics[cursor_metric];
349
350 List<TreeItem *> stack;
351 List<TreeItem *> categories;
352
353 TreeItem *ensure_selected = nullptr;
354
355 for (int i = 1; i < m.areas.size() - 1; i++) {
356 TreeItem *parent = stack.size() ? stack.back()->get() : root;
357
358 String name = m.areas[i].name;
359
360 float cpu_time = m.areas[i].cpu_time;
361 float gpu_time = m.areas[i].gpu_time;
362 if (i < m.areas.size() - 1) {
363 cpu_time = m.areas[i + 1].cpu_time - cpu_time;
364 gpu_time = m.areas[i + 1].gpu_time - gpu_time;
365 }
366
367 if (name.begins_with(">")) {
368 TreeItem *category = variables->create_item(parent);
369
370 stack.push_back(category);
371 categories.push_back(category);
372
373 name = name.substr(1);
374
375 category->set_text(0, name);
376 category->set_metadata(1, cpu_time);
377 category->set_metadata(2, gpu_time);
378 continue;
379 }
380
381 if (name.begins_with("<")) {
382 stack.pop_back();
383 continue;
384 }
385 TreeItem *category = variables->create_item(parent);
386
387 for (TreeItem *E : stack) {
388 float total_cpu = E->get_metadata(1);
389 float total_gpu = E->get_metadata(2);
390 total_cpu += cpu_time;
391 total_gpu += gpu_time;
392 E->set_metadata(1, total_cpu);
393 E->set_metadata(2, total_gpu);
394 }

Callers

nothing calls this directly

Calls 15

begins_withMethod · 0.80
substrMethod · 0.80
set_metadataMethod · 0.80
get_metadataMethod · 0.80
set_icon_modulateMethod · 0.80
sizeMethod · 0.65
clearMethod · 0.45
create_itemMethod · 0.45
getMethod · 0.45
backMethod · 0.45
push_backMethod · 0.45

Tested by

no test coverage detected