tracing: add some more startup related events and a new --profile-until-event flag (#3385)

While trying to narrow down why sometimes SDL takes 20-40seconds to
initialize I built up some more profiling features.

TLDR - I still don't know why SDL is taking a long time but I've
narrowed it down to it initializing the `GAME_CONTROLLER` subsystem.
This isn't unprecedented, I found numerous github issues and articles
suggesting this is the problem:

![image](https://github.com/open-goal/jak-project/assets/13153231/1853326b-7a40-458e-87a0-f7a9f44781e3)

I imagine it is hardware/OS related on some level, there are even some
recent commits in SDL that have made it worse on certain platforms. I've
had this problem myself so I will hope to get it again soon so i can
debug where in the SDL code the delay occurs and make a proper bug
report. Hopefully this helps but it's not yet confirmed -
https://github.com/open-goal/jak-project/pull/3384
This commit is contained in:
Tyler Wilding
2024-02-23 14:44:17 -05:00
committed by GitHub
parent 1af6503784
commit 1cc20508e9
7 changed files with 150 additions and 94 deletions
+4
View File
@@ -96,6 +96,7 @@ int main(int argc, char** argv) {
bool disable_avx2 = false;
bool disable_display = false;
bool enable_profiling = false;
std::string profile_until_event = "";
std::string gpu_test = "";
std::string gpu_test_out_path = "";
int port_number = -1;
@@ -111,6 +112,8 @@ int main(int argc, char** argv) {
app.add_flag("--no-avx2", disable_avx2, "Disable AVX2 for testing");
app.add_flag("--no-display", disable_display, "Disable video display");
app.add_flag("--profile", enable_profiling, "Enables profiling immediately from startup");
app.add_option("--profile-until-event", profile_until_event,
"Stops recording profile events once an event with this name is seen");
app.add_option("--gpu-test", gpu_test,
"Tests for minimum graphics requirements. Valid Options are: [opengl]");
app.add_option("--gpu-test-out-path", gpu_test_out_path,
@@ -141,6 +144,7 @@ int main(int argc, char** argv) {
}
prof().set_enable(enable_profiling);
prof().set_waiting_for_event(profile_until_event);
// Create struct with all non-kmachine handled args to pass to the runtime
GameLaunchOptions game_options;