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

Method update_monitors

editor/debugger/editor_performance_profiler.cpp:328–362  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

326}
327
328void EditorPerformanceProfiler::update_monitors(const Vector<StringName> &p_names) {
329 HashMap<StringName, int> names;
330 for (int i = 0; i < p_names.size(); i++) {
331 names.insert("custom:" + p_names[i], Performance::MONITOR_MAX + i);
332 }
333
334 {
335 HashMap<StringName, Monitor>::Iterator E = monitors.begin();
336 while (E != monitors.end()) {
337 HashMap<StringName, Monitor>::Iterator N = E;
338 ++N;
339 if (String(E->key).begins_with("custom:")) {
340 if (!names.has(E->key)) {
341 monitors.remove(E);
342 } else {
343 E->value.frame_index = names[E->key];
344 names.erase(E->key);
345 }
346 }
347 E = N;
348 }
349 }
350
351 for (const KeyValue<StringName, int> &E : names) {
352 String name = String(E.key).replace_first("custom:", "");
353 String base = "Custom";
354 if (name.get_slice_count("/") == 2) {
355 base = name.get_slicec('/', 0);
356 name = name.get_slicec('/', 1);
357 }
358 monitors.insert(E.key, Monitor(name, base, E.value, Performance::MONITOR_TYPE_QUANTITY, nullptr));
359 }
360
361 _build_monitor_tree();
362}
363
364void EditorPerformanceProfiler::add_profile_frame(const Vector<float> &p_values) {
365 for (KeyValue<StringName, Monitor> &E : monitors) {

Callers 1

Calls 13

begins_withMethod · 0.80
replace_firstMethod · 0.80
get_slice_countMethod · 0.80
get_slicecMethod · 0.80
MonitorClass · 0.70
sizeMethod · 0.65
StringClass · 0.50
insertMethod · 0.45
beginMethod · 0.45
endMethod · 0.45
hasMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected