diff --git a/common/log/log.cpp b/common/log/log.cpp index dfe623b0bc..8457b0cbfa 100644 --- a/common/log/log.cpp +++ b/common/log/log.cpp @@ -140,7 +140,7 @@ void printstd(const char* format, va_list arg_list) { internal::log_vprintf(format, arg_list); } -// how many extra log files for a single program should be kept? +// how many extra log files for a single program should be kept constexpr int LOG_ROTATE_MAX = 10; void set_file(const std::string& filename, diff --git a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp index abef0ff791..36e76e1279 100644 --- a/decompiler/ObjectFile/ObjectFileDB_IR2.cpp +++ b/decompiler/ObjectFile/ObjectFileDB_IR2.cpp @@ -5,13 +5,13 @@ #include "ObjectFileDB.h" +#include "common/formatter/formatter.h" #include "common/goos/PrettyPrinter.h" #include "common/link_types.h" #include "common/log/log.h" #include "common/util/FileUtil.h" #include "common/util/Timer.h" #include "common/util/string_util.h" -#include #include "decompiler/IR2/Form.h" #include "decompiler/analysis/analyze_inspect_method.h" diff --git a/game/graphics/opengl_renderer/debug_gui.cpp b/game/graphics/opengl_renderer/debug_gui.cpp index 5dcfdda26a..b0c9dcece4 100644 --- a/game/graphics/opengl_renderer/debug_gui.cpp +++ b/game/graphics/opengl_renderer/debug_gui.cpp @@ -1,9 +1,7 @@ - #include "debug_gui.h" -#include - #include "common/global_profiler/GlobalProfiler.h" +#include "common/util/string_util.h" #include "game/graphics/display.h" #include "game/graphics/gfx.h" @@ -164,10 +162,22 @@ void OpenGlDebugGui::draw(const DmaStats& dma_stats) { } if (ImGui::BeginMenu("Event Profiler")) { - if (ImGui::Checkbox("Record", &record_events)) { + if (ImGui::Checkbox("Record Events", &record_events)) { prof().set_enable(record_events); } - ImGui::MenuItem("Dump to file", nullptr, &dump_events); + ImGui::InputInt("Event Buffer Size", &prof().m_max_events); + if (ImGui::Button("Resize")) { + prof().update_event_buffer_size(); + } + ImGui::Separator(); + ImGui::Checkbox("Enable Compression", &prof().m_enable_compression); + if (ImGui::Button("Dump to File")) { + record_events = false; + prof().dump_to_json(); + } + // if (ImGui::Button("Open dump folder")) { + // // TODO - https://github.com/mlabbe/nativefiledialog + // } ImGui::EndMenu(); } diff --git a/game/graphics/opengl_renderer/debug_gui.h b/game/graphics/opengl_renderer/debug_gui.h index 52c1cc2e63..239d8a01df 100644 --- a/game/graphics/opengl_renderer/debug_gui.h +++ b/game/graphics/opengl_renderer/debug_gui.h @@ -64,7 +64,6 @@ class OpenGlDebugGui { bool small_profiler = false; bool record_events = false; - bool dump_events = false; bool want_reboot_in_debug = false; bool screenshot_hotkey_enabled = true; diff --git a/game/graphics/pipelines/opengl.cpp b/game/graphics/pipelines/opengl.cpp index ec54f40405..f36bb62334 100644 --- a/game/graphics/pipelines/opengl.cpp +++ b/game/graphics/pipelines/opengl.cpp @@ -448,23 +448,6 @@ void render_game_frame(int game_width, } } -void update_global_profiler() { - if (g_gfx_data->debug_gui.dump_events) { - prof().set_enable(false); - g_gfx_data->debug_gui.dump_events = false; - - // TODO - the file rotation code had an infinite loop here if it couldn't find anything - // matching the format - // - // Does the existing log rotation code have that problem? - - auto file_path = file_util::get_jak_project_dir() / "profile_data" / - fmt::format("prof-{}.json", str_util::current_local_timestamp_no_colons()); - file_util::create_dir_if_needed_for_file(file_path); - prof().dump_to_json(file_path.string()); - } -} - void GLDisplay::process_sdl_events() { SDL_Event evt; while (SDL_PollEvent(&evt) != 0) { @@ -603,7 +586,6 @@ void GLDisplay::render() { // Start timing for the next frame. g_gfx_data->debug_gui.start_frame(); prof().instant_event("ROOT"); - update_global_profiler(); // toggle even odd and wake up engine waiting on vsync. // TODO: we could play with moving this earlier, right after the final bucket renderer.