| 326 | } |
| 327 | |
| 328 | void 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 | |
| 364 | void EditorPerformanceProfiler::add_profile_frame(const Vector<float> &p_values) { |
| 365 | for (KeyValue<StringName, Monitor> &E : monitors) { |
no test coverage detected