1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-07 12:30:27 +00:00

Improve startup benchmarking

Move the benchmarking measuring methods from `Engine` to `OS` to allow for platform specific overrides (e.g: can be used to hook into platform specific benchmarking and tracing capabilities).
This commit is contained in:
Fredia Huya-Kouadio
2023-01-13 11:24:12 -08:00
parent f581f21dd6
commit 831b4a5366
26 changed files with 386 additions and 129 deletions

View File

@@ -1041,7 +1041,7 @@ void EditorNode::_sources_changed(bool p_exist) {
if (waiting_for_first_scan) {
waiting_for_first_scan = false;
Engine::get_singleton()->startup_benchmark_end_measure(); // editor_scan_and_reimport
OS::get_singleton()->benchmark_end_measure("editor_scan_and_import");
// Reload the global shader variables, but this time
// loading textures, as they are now properly imported.
@@ -1055,16 +1055,12 @@ void EditorNode::_sources_changed(bool p_exist) {
_load_editor_layout();
if (!defer_load_scene.is_empty()) {
Engine::get_singleton()->startup_benchmark_begin_measure("editor_load_scene");
OS::get_singleton()->benchmark_begin_measure("editor_load_scene");
load_scene(defer_load_scene);
defer_load_scene = "";
Engine::get_singleton()->startup_benchmark_end_measure();
OS::get_singleton()->benchmark_end_measure("editor_load_scene");
if (use_startup_benchmark) {
Engine::get_singleton()->startup_dump(startup_benchmark_file);
startup_benchmark_file = String();
use_startup_benchmark = false;
}
OS::get_singleton()->benchmark_dump();
}
}
}
@@ -4392,13 +4388,9 @@ void EditorNode::_editor_file_dialog_unregister(EditorFileDialog *p_dialog) {
Vector<EditorNodeInitCallback> EditorNode::_init_callbacks;
void EditorNode::_begin_first_scan() {
Engine::get_singleton()->startup_benchmark_begin_measure("editor_scan_and_import");
OS::get_singleton()->benchmark_begin_measure("editor_scan_and_import");
EditorFileSystem::get_singleton()->scan();
}
void EditorNode::set_use_startup_benchmark(bool p_use_startup_benchmark, const String &p_startup_benchmark_file) {
use_startup_benchmark = p_use_startup_benchmark;
startup_benchmark_file = p_startup_benchmark_file;
}
Error EditorNode::export_preset(const String &p_preset, const String &p_path, bool p_debug, bool p_pack_only) {
export_defer.preset = p_preset;