Remove PerformanceMonitor and update references to PerformanceProfiler

- Deleted the PerformanceMonitor implementation and header files as functionality has been fully integrated into gfx::PerformanceProfiler.
- Updated all relevant source files to replace PerformanceMonitor and ScopedTimer with their gfx counterparts, ensuring consistent performance monitoring across the application.
This commit is contained in:
scawful
2025-09-29 20:30:31 -04:00
parent 62230fbe5c
commit 100fc23a2e
17 changed files with 49 additions and 77 deletions

View File

@@ -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)

View File

@@ -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.

View File

@@ -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_

View File

@@ -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()) {

View File

@@ -6,7 +6,7 @@
#include <thread>
#include <mutex>
#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<zelda3::Room, 0x128>& 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(),

View File

@@ -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<std::chrono::milliseconds>(

View File

@@ -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

View File

@@ -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

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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"

View File

@@ -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<int>(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());
}
}

View File

@@ -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"

View File

@@ -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();
}

View File

@@ -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();
}

View File

@@ -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());
}
}

View File

@@ -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}