| 2498 | } |
| 2499 | |
| 2500 | void GDScriptLanguage::profiling_collate_native_call_data(bool p_accumulated) { |
| 2501 | #ifdef DEBUG_ENABLED |
| 2502 | // The same native call can be called from multiple functions, so join them together here. |
| 2503 | // Only use the name of the function (ie signature.split[2]). |
| 2504 | HashMap<String, GDScriptFunction::Profile::NativeProfile *> seen_nat_calls; |
| 2505 | SelfList<GDScriptFunction> *elem = function_list.first(); |
| 2506 | while (elem) { |
| 2507 | HashMap<String, GDScriptFunction::Profile::NativeProfile> *nat_calls = p_accumulated ? &elem->self()->profile.native_calls : &elem->self()->profile.last_native_calls; |
| 2508 | HashMap<String, GDScriptFunction::Profile::NativeProfile>::Iterator it = nat_calls->begin(); |
| 2509 | |
| 2510 | while (it != nat_calls->end()) { |
| 2511 | Vector<String> sig = it->value.signature.split("::"); |
| 2512 | HashMap<String, GDScriptFunction::Profile::NativeProfile *>::ConstIterator already_found = seen_nat_calls.find(sig[2]); |
| 2513 | if (already_found) { |
| 2514 | already_found->value->total_time += it->value.total_time; |
| 2515 | already_found->value->call_count += it->value.call_count; |
| 2516 | elem->self()->profile.last_native_calls.remove(it); |
| 2517 | } else { |
| 2518 | seen_nat_calls.insert(sig[2], &it->value); |
| 2519 | } |
| 2520 | ++it; |
| 2521 | } |
| 2522 | elem = elem->next(); |
| 2523 | } |
| 2524 | #endif |
| 2525 | } |
| 2526 | |
| 2527 | struct GDScriptDepSort { |
| 2528 | //must support sorting so inheritance works properly (parent must be reloaded first) |