diff --git a/src/app/core/core.cmake b/src/app/core/core.cmake index acef1602..6a2f5126 100644 --- a/src/app/core/core.cmake +++ b/src/app/core/core.cmake @@ -5,7 +5,6 @@ set( app/core/project.cc app/core/window.cc app/core/asar_wrapper.cc - app/core/performance_monitor.cc ) if (WIN32 OR MINGW OR UNIX AND NOT APPLE) diff --git a/src/app/core/performance_monitor.cc b/src/app/core/performance_monitor.cc deleted file mode 100644 index 32068a16..00000000 --- a/src/app/core/performance_monitor.cc +++ /dev/null @@ -1,7 +0,0 @@ -// This file provides backward compatibility for the old PerformanceMonitor interface -// All functionality has been merged into gfx::PerformanceProfiler -// The header now provides aliases, so no implementation is needed here - -// Note: All existing code using core::PerformanceMonitor and core::ScopedTimer -// will now automatically use the unified gfx::PerformanceProfiler system -// with full memory pool integration and enhanced functionality. \ No newline at end of file diff --git a/src/app/core/performance_monitor.h b/src/app/core/performance_monitor.h deleted file mode 100644 index aea9844f..00000000 --- a/src/app/core/performance_monitor.h +++ /dev/null @@ -1,19 +0,0 @@ -#ifndef YAZE_APP_CORE_PERFORMANCE_MONITOR_H_ -#define YAZE_APP_CORE_PERFORMANCE_MONITOR_H_ - -// This file provides backward compatibility for the old PerformanceMonitor interface -// All functionality has been merged into gfx::PerformanceProfiler - -#include "app/gfx/performance_profiler.h" - -namespace yaze { -namespace core { - -// Alias the unified profiler to maintain backward compatibility -using PerformanceMonitor = gfx::PerformanceProfiler; -using ScopedTimer = gfx::ScopedTimer; - -} // namespace core -} // namespace yaze - -#endif // YAZE_APP_CORE_PERFORMANCE_MONITOR_H_ \ No newline at end of file diff --git a/src/app/editor/dungeon/dungeon_editor.cc b/src/app/editor/dungeon/dungeon_editor.cc index 27f503fc..0585eb5a 100644 --- a/src/app/editor/dungeon/dungeon_editor.cc +++ b/src/app/editor/dungeon/dungeon_editor.cc @@ -1,7 +1,7 @@ #include "dungeon_editor.h" #include "absl/strings/str_format.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/window.h" #include "app/gfx/arena.h" #include "app/gfx/snes_palette.h" @@ -47,7 +47,7 @@ void DungeonEditor::Initialize() { } absl::Status DungeonEditor::Load() { - core::ScopedTimer timer("DungeonEditor::Load"); + gfx::ScopedTimer timer("DungeonEditor::Load"); if (!rom_ || !rom_->is_loaded()) { return absl::FailedPreconditionError("ROM not loaded"); @@ -57,18 +57,18 @@ absl::Status DungeonEditor::Load() { // Use room loader component for loading rooms { - core::ScopedTimer rooms_timer("DungeonEditor::LoadAllRooms"); + gfx::ScopedTimer rooms_timer("DungeonEditor::LoadAllRooms"); RETURN_IF_ERROR(room_loader_.LoadAllRooms(rooms_)); } { - core::ScopedTimer entrances_timer("DungeonEditor::LoadRoomEntrances"); + gfx::ScopedTimer entrances_timer("DungeonEditor::LoadRoomEntrances"); RETURN_IF_ERROR(room_loader_.LoadRoomEntrances(entrances_)); } // Load the palette group and palette for the dungeon { - core::ScopedTimer palette_timer("DungeonEditor::LoadPalettes"); + gfx::ScopedTimer palette_timer("DungeonEditor::LoadPalettes"); full_palette_ = dungeon_man_pal_group[current_palette_group_id_]; ASSIGN_OR_RETURN(current_palette_group_, gfx::CreatePaletteGroupFromLargePalette(full_palette_)); @@ -76,13 +76,13 @@ absl::Status DungeonEditor::Load() { // Calculate usage statistics { - core::ScopedTimer usage_timer("DungeonEditor::CalculateUsageStats"); + gfx::ScopedTimer usage_timer("DungeonEditor::CalculateUsageStats"); usage_tracker_.CalculateUsageStats(rooms_); } // Initialize the new editor system { - core::ScopedTimer init_timer("DungeonEditor::InitializeSystem"); + gfx::ScopedTimer init_timer("DungeonEditor::InitializeSystem"); if (dungeon_editor_system_) { auto status = dungeon_editor_system_->Initialize(); if (!status.ok()) { diff --git a/src/app/editor/dungeon/dungeon_room_loader.cc b/src/app/editor/dungeon/dungeon_room_loader.cc index a5ceb7d0..0b380936 100644 --- a/src/app/editor/dungeon/dungeon_room_loader.cc +++ b/src/app/editor/dungeon/dungeon_room_loader.cc @@ -6,7 +6,7 @@ #include #include -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/gfx/snes_palette.h" #include "app/zelda3/dungeon/room.h" #include "util/log.h" @@ -84,7 +84,7 @@ absl::Status DungeonRoomLoader::LoadAllRooms(std::array& ro // Process collected results on main thread { - core::ScopedTimer postprocess_timer("DungeonRoomLoader::PostProcessResults"); + gfx::ScopedTimer postprocess_timer("DungeonRoomLoader::PostProcessResults"); // Sort results by room ID for consistent ordering std::sort(room_size_results.begin(), room_size_results.end(), diff --git a/src/app/editor/editor_manager.cc b/src/app/editor/editor_manager.cc index de2a32a1..a9c6cee1 100644 --- a/src/app/editor/editor_manager.cc +++ b/src/app/editor/editor_manager.cc @@ -8,7 +8,7 @@ #include "absl/strings/match.h" #include "absl/strings/str_cat.h" #include "app/core/features.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/platform/file_dialog.h" #include "app/core/project.h" #include "app/editor/code/assembly_editor.h" @@ -1718,7 +1718,7 @@ absl::Status EditorManager::LoadAssets() { RETURN_IF_ERROR(current_editor_set_->music_editor_.Load()); RETURN_IF_ERROR(current_editor_set_->palette_editor_.Load()); - core::PerformanceMonitor::Get().PrintSummary(); + gfx::PerformanceProfiler::Get().PrintSummary(); auto end_time = std::chrono::steady_clock::now(); auto duration = std::chrono::duration_cast( diff --git a/src/app/editor/graphics/palette_editor.cc b/src/app/editor/graphics/palette_editor.cc index 67bb81f8..b80b33aa 100644 --- a/src/app/editor/graphics/palette_editor.cc +++ b/src/app/editor/graphics/palette_editor.cc @@ -2,7 +2,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/gfx/snes_palette.h" #include "app/gui/color.h" #include "imgui/imgui.h" @@ -189,7 +189,7 @@ absl::Status DisplayPalette(gfx::SnesPalette& palette, bool loaded) { void PaletteEditor::Initialize() {} absl::Status PaletteEditor::Load() { - core::ScopedTimer timer("PaletteEditor::Load"); + gfx::ScopedTimer timer("PaletteEditor::Load"); if (rom()->is_loaded()) { // Initialize the labels diff --git a/src/app/editor/graphics/screen_editor.cc b/src/app/editor/graphics/screen_editor.cc index 05397943..a737e964 100644 --- a/src/app/editor/graphics/screen_editor.cc +++ b/src/app/editor/graphics/screen_editor.cc @@ -6,7 +6,7 @@ #include "absl/strings/str_format.h" #include "absl/strings/string_view.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/platform/file_dialog.h" #include "app/core/window.h" #include "app/gfx/arena.h" @@ -32,7 +32,7 @@ constexpr uint32_t kRedPen = 0xFF0000FF; void ScreenEditor::Initialize() {} absl::Status ScreenEditor::Load() { - core::ScopedTimer timer("ScreenEditor::Load"); + gfx::ScopedTimer timer("ScreenEditor::Load"); ASSIGN_OR_RETURN(dungeon_maps_, zelda3::LoadDungeonMaps(*rom(), dungeon_map_labels_)); @@ -165,7 +165,7 @@ void ScreenEditor::DrawInventoryToolset() { } void ScreenEditor::DrawDungeonMapScreen(int i) { - core::ScopedTimer timer("screen_editor_draw_dungeon_map_screen"); + gfx::ScopedTimer timer("screen_editor_draw_dungeon_map_screen"); auto& current_dungeon = dungeon_maps_[selected_dungeon]; @@ -318,7 +318,7 @@ void ScreenEditor::DrawDungeonMapsTabs() { * - Lazy loading of tile graphics data */ void ScreenEditor::DrawDungeonMapsRoomGfx() { - core::ScopedTimer timer("screen_editor_draw_dungeon_maps_room_gfx"); + gfx::ScopedTimer timer("screen_editor_draw_dungeon_maps_room_gfx"); if (ImGui::BeginChild("##DungeonMapTiles", ImVec2(0, 0), true)) { // Enhanced tilesheet canvas with improved tile selection diff --git a/src/app/editor/message/message_editor.cc b/src/app/editor/message/message_editor.cc index a4f7c192..f1744e81 100644 --- a/src/app/editor/message/message_editor.cc +++ b/src/app/editor/message/message_editor.cc @@ -6,7 +6,7 @@ #include "absl/status/status.h" #include "absl/strings/str_cat.h" #include "absl/strings/str_format.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/platform/file_dialog.h" #include "app/core/window.h" #include "app/gfx/bitmap.h" @@ -93,7 +93,7 @@ void MessageEditor::Initialize() { } absl::Status MessageEditor::Load() { - core::ScopedTimer timer("MessageEditor::Load"); + gfx::ScopedTimer timer("MessageEditor::Load"); return absl::OkStatus(); } diff --git a/src/app/editor/music/music_editor.cc b/src/app/editor/music/music_editor.cc index 9bf78a59..924b5246 100644 --- a/src/app/editor/music/music_editor.cc +++ b/src/app/editor/music/music_editor.cc @@ -1,7 +1,7 @@ #include "music_editor.h" #include "absl/strings/str_format.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/editor/code/assembly_editor.h" #include "app/gui/icons.h" #include "app/gui/input.h" @@ -13,7 +13,7 @@ namespace editor { void MusicEditor::Initialize() {} absl::Status MusicEditor::Load() { - core::ScopedTimer timer("MusicEditor::Load"); + gfx::ScopedTimer timer("MusicEditor::Load"); return absl::OkStatus(); } diff --git a/src/app/editor/overworld/map_properties.cc b/src/app/editor/overworld/map_properties.cc index b4984b3f..fa9012e5 100644 --- a/src/app/editor/overworld/map_properties.cc +++ b/src/app/editor/overworld/map_properties.cc @@ -1,6 +1,6 @@ #include "app/editor/overworld/map_properties.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/editor/overworld/overworld_editor.h" #include "app/editor/overworld/ui_constants.h" #include "app/gfx/atlas_renderer.h" diff --git a/src/app/editor/overworld/overworld_editor.cc b/src/app/editor/overworld/overworld_editor.cc index 82fd34ae..6984237f 100644 --- a/src/app/editor/overworld/overworld_editor.cc +++ b/src/app/editor/overworld/overworld_editor.cc @@ -12,7 +12,7 @@ #include "absl/strings/str_format.h" #include "app/core/asar_wrapper.h" #include "app/core/features.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/window.h" #include "app/editor/overworld/entity.h" #include "app/editor/overworld/map_properties.h" @@ -1759,12 +1759,12 @@ absl::Status OverworldEditor::Save() { } absl::Status OverworldEditor::LoadGraphics() { - core::ScopedTimer timer("LoadGraphics"); + gfx::ScopedTimer timer("LoadGraphics"); util::logf("Loading overworld."); // Load the Link to the Past overworld. { - core::ScopedTimer load_timer("Overworld::Load"); + gfx::ScopedTimer load_timer("Overworld::Load"); RETURN_IF_ERROR(overworld_.Load(rom_)); } palette_ = overworld_.current_area_palette(); @@ -1774,7 +1774,7 @@ absl::Status OverworldEditor::LoadGraphics() { // Phase 1: Create bitmaps without textures for faster loading // This avoids blocking the main thread with GPU texture creation { - core::ScopedTimer gfx_timer("CreateBitmapWithoutTexture_Graphics"); + gfx::ScopedTimer gfx_timer("CreateBitmapWithoutTexture_Graphics"); Renderer::Get().CreateBitmapWithoutTexture(0x80, kOverworldMapSize, 0x40, overworld_.current_graphics(), current_gfx_bmp_, palette_); @@ -1782,7 +1782,7 @@ absl::Status OverworldEditor::LoadGraphics() { util::logf("Loading overworld tileset (deferred textures)."); { - core::ScopedTimer tileset_timer("CreateBitmapWithoutTexture_Tileset"); + gfx::ScopedTimer tileset_timer("CreateBitmapWithoutTexture_Tileset"); Renderer::Get().CreateBitmapWithoutTexture( 0x80, 0x2000, 0x08, overworld_.tile16_blockset_data(), tile16_blockset_bmp_, palette_); @@ -1794,7 +1794,7 @@ absl::Status OverworldEditor::LoadGraphics() { util::logf("Loading overworld tile16 graphics."); { - core::ScopedTimer tilemap_timer("CreateTilemap"); + gfx::ScopedTimer tilemap_timer("CreateTilemap"); tile16_blockset_ = gfx::CreateTilemap(tile16_blockset_data, 0x80, 0x2000, kTile16Size, zelda3::kNumTile16Individual, palette_); @@ -1818,7 +1818,7 @@ absl::Status OverworldEditor::LoadGraphics() { 3); // 8 maps per world * 3 worlds { - core::ScopedTimer maps_timer("CreateEssentialOverworldMaps"); + gfx::ScopedTimer maps_timer("CreateEssentialOverworldMaps"); for (int i = 0; i < zelda3::kNumOverworldMaps; ++i) { bool is_essential = false; @@ -1856,7 +1856,7 @@ absl::Status OverworldEditor::LoadGraphics() { const int initial_texture_count = std::min(4, static_cast(maps_to_texture.size())); { - core::ScopedTimer initial_textures_timer("CreateInitialTextures"); + gfx::ScopedTimer initial_textures_timer("CreateInitialTextures"); for (int i = 0; i < initial_texture_count; ++i) { Renderer::Get().RenderBitmap(maps_to_texture[i]); } @@ -1868,7 +1868,7 @@ absl::Status OverworldEditor::LoadGraphics() { if (core::FeatureFlags::get().overworld.kDrawOverworldSprites) { { - core::ScopedTimer sprites_timer("LoadSpriteGraphics"); + gfx::ScopedTimer sprites_timer("LoadSpriteGraphics"); RETURN_IF_ERROR(LoadSpriteGraphics()); } } diff --git a/src/app/editor/overworld/scratch_space.cc b/src/app/editor/overworld/scratch_space.cc index dad4fca9..c4dd21bd 100644 --- a/src/app/editor/overworld/scratch_space.cc +++ b/src/app/editor/overworld/scratch_space.cc @@ -12,7 +12,7 @@ #include "absl/strings/str_format.h" #include "app/core/asar_wrapper.h" #include "app/core/features.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/window.h" #include "app/editor/overworld/entity.h" #include "app/editor/overworld/map_properties.h" diff --git a/src/app/editor/sprite/sprite_editor.cc b/src/app/editor/sprite/sprite_editor.cc index 530debb5..47dee667 100644 --- a/src/app/editor/sprite/sprite_editor.cc +++ b/src/app/editor/sprite/sprite_editor.cc @@ -1,6 +1,6 @@ #include "sprite_editor.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/core/platform/file_dialog.h" #include "app/editor/sprite/zsprite.h" #include "app/gfx/arena.h" @@ -26,7 +26,7 @@ using ImGui::Text; void SpriteEditor::Initialize() {} absl::Status SpriteEditor::Load() { - core::ScopedTimer timer("SpriteEditor::Load"); + gfx::ScopedTimer timer("SpriteEditor::Load"); return absl::OkStatus(); } diff --git a/src/app/editor/system/settings_editor.cc b/src/app/editor/system/settings_editor.cc index 5c18119c..9d8b4196 100644 --- a/src/app/editor/system/settings_editor.cc +++ b/src/app/editor/system/settings_editor.cc @@ -3,7 +3,7 @@ #include "absl/status/status.h" #include "app/core/features.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/gui/style.h" #include "imgui/imgui.h" @@ -25,7 +25,7 @@ using ImGui::TableSetupColumn; void SettingsEditor::Initialize() {} absl::Status SettingsEditor::Load() { - core::ScopedTimer timer("SettingsEditor::Load"); + gfx::ScopedTimer timer("SettingsEditor::Load"); return absl::OkStatus(); } diff --git a/src/app/zelda3/overworld/overworld.cc b/src/app/zelda3/overworld/overworld.cc index 385450fe..afff5854 100644 --- a/src/app/zelda3/overworld/overworld.cc +++ b/src/app/zelda3/overworld/overworld.cc @@ -10,7 +10,7 @@ #include "absl/status/status.h" #include "app/core/features.h" -#include "app/core/performance_monitor.h" +#include "app/gfx/performance_profiler.h" #include "app/gfx/compression.h" #include "app/gfx/snes_tile.h" #include "app/rom.h" @@ -25,7 +25,7 @@ namespace yaze { namespace zelda3 { absl::Status Overworld::Load(Rom* rom) { - core::ScopedTimer timer("Overworld::Load"); + gfx::ScopedTimer timer("Overworld::Load"); if (rom->size() == 0) { return absl::InvalidArgumentError("ROM file not loaded"); @@ -34,20 +34,20 @@ absl::Status Overworld::Load(Rom* rom) { // Phase 1: Tile Assembly (can be parallelized) { - core::ScopedTimer assembly_timer("AssembleTiles"); + gfx::ScopedTimer assembly_timer("AssembleTiles"); RETURN_IF_ERROR(AssembleMap32Tiles()); RETURN_IF_ERROR(AssembleMap16Tiles()); } // Phase 2: Map Decompression (major bottleneck - now parallelized) { - core::ScopedTimer decompression_timer("DecompressAllMapTiles"); + gfx::ScopedTimer decompression_timer("DecompressAllMapTiles"); RETURN_IF_ERROR(DecompressAllMapTilesParallel()); } // Phase 3: Map Object Creation (fast) { - core::ScopedTimer map_creation_timer("CreateOverworldMapObjects"); + gfx::ScopedTimer map_creation_timer("CreateOverworldMapObjects"); for (int map_index = 0; map_index < kNumOverworldMaps; ++map_index) overworld_maps_.emplace_back(map_index, rom_); @@ -67,40 +67,40 @@ absl::Status Overworld::Load(Rom* rom) { // Phase 5: Data Loading (with individual timing) { - core::ScopedTimer data_loading_timer("LoadOverworldData"); + gfx::ScopedTimer data_loading_timer("LoadOverworldData"); { - core::ScopedTimer tile_types_timer("LoadTileTypes"); + gfx::ScopedTimer tile_types_timer("LoadTileTypes"); LoadTileTypes(); } { - core::ScopedTimer entrances_timer("LoadEntrances"); + gfx::ScopedTimer entrances_timer("LoadEntrances"); RETURN_IF_ERROR(LoadEntrances()); } { - core::ScopedTimer holes_timer("LoadHoles"); + gfx::ScopedTimer holes_timer("LoadHoles"); RETURN_IF_ERROR(LoadHoles()); } { - core::ScopedTimer exits_timer("LoadExits"); + gfx::ScopedTimer exits_timer("LoadExits"); RETURN_IF_ERROR(LoadExits()); } { - core::ScopedTimer items_timer("LoadItems"); + gfx::ScopedTimer items_timer("LoadItems"); RETURN_IF_ERROR(LoadItems()); } { - core::ScopedTimer overworld_maps_timer("LoadOverworldMaps"); + gfx::ScopedTimer overworld_maps_timer("LoadOverworldMaps"); RETURN_IF_ERROR(LoadOverworldMaps()); } { - core::ScopedTimer sprites_timer("LoadSprites"); + gfx::ScopedTimer sprites_timer("LoadSprites"); RETURN_IF_ERROR(LoadSprites()); } } diff --git a/src/cli/z3ed.cmake b/src/cli/z3ed.cmake index 5059a7be..4e8d94ef 100644 --- a/src/cli/z3ed.cmake +++ b/src/cli/z3ed.cmake @@ -31,7 +31,6 @@ add_executable( app/rom.cc app/core/project.cc app/core/asar_wrapper.cc - app/core/performance_monitor.cc ${FILE_DIALOG_SRC} ${YAZE_APP_EMU_SRC} ${YAZE_APP_GFX_SRC}