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

Method add_frame_metric

editor/debugger/editor_visual_profiler.cpp:55–111  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

53}
54
55void EditorVisualProfiler::add_frame_metric(const Metric &p_metric) {
56 ++last_metric;
57 if (last_metric >= frame_metrics.size()) {
58 last_metric = 0;
59 }
60
61 frame_metrics.write[last_metric] = p_metric;
62
63 List<String> stack;
64 for (int i = 0; i < frame_metrics[last_metric].areas.size(); i++) {
65 String name = frame_metrics[last_metric].areas[i].name;
66 frame_metrics.write[last_metric].areas.write[i].color_cache = _get_color_from_signature(name);
67 String full_name;
68
69 if (name[0] == '<') {
70 stack.pop_back();
71 }
72
73 if (stack.size()) {
74 full_name = stack.back()->get() + name;
75 } else {
76 full_name = name;
77 }
78
79 if (name[0] == '>') {
80 stack.push_back(full_name + "/");
81 }
82
83 frame_metrics.write[last_metric].areas.write[i].fullpath_cache = full_name;
84 }
85
86 updating_frame = true;
87 clear_button->set_disabled(false);
88 cursor_metric_edit->set_max(frame_metrics[last_metric].frame_number);
89 cursor_metric_edit->set_min(MAX(int64_t(frame_metrics[last_metric].frame_number) - frame_metrics.size(), 0));
90
91 if (!seeking) {
92 cursor_metric_edit->set_value(frame_metrics[last_metric].frame_number);
93 if (hover_metric != -1) {
94 hover_metric++;
95 if (hover_metric >= frame_metrics.size()) {
96 hover_metric = 0;
97 }
98 }
99 }
100 updating_frame = false;
101
102 if (frame_delay->is_stopped()) {
103 frame_delay->set_wait_time(0.1);
104 frame_delay->start();
105 }
106
107 if (plot_delay->is_stopped()) {
108 plot_delay->set_wait_time(0.1);
109 plot_delay->start();
110 }
111}
112

Callers

nothing calls this directly

Calls 13

MAXFunction · 0.85
is_stoppedMethod · 0.80
set_wait_timeMethod · 0.80
sizeMethod · 0.65
pop_backMethod · 0.45
getMethod · 0.45
backMethod · 0.45
push_backMethod · 0.45
set_disabledMethod · 0.45
set_maxMethod · 0.45
set_minMethod · 0.45
set_valueMethod · 0.45

Tested by

no test coverage detected