From ab5a10374bb71d1d0c558a5f312665f220d91677 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Sun, 22 Sep 2024 08:04:39 -0700 Subject: [PATCH] FEXCore: Remove BlockSamplingData This was a legacy interface that has long lost its implementation and has long lost its use. This interface was similar to an older Dolphin-Emu interface that was useful in that project, but isn't really useful in a world with hundreds of threads and processes running at the same time. --- FEXCore/Source/CMakeLists.txt | 1 - FEXCore/Source/Interface/Context/Context.h | 4 -- .../Interface/Core/BlockSamplingData.cpp | 51 ------------------- .../Source/Interface/Core/BlockSamplingData.h | 25 --------- FEXCore/Source/Interface/Core/Core.cpp | 3 -- 5 files changed, 84 deletions(-) delete mode 100644 FEXCore/Source/Interface/Core/BlockSamplingData.cpp delete mode 100644 FEXCore/Source/Interface/Core/BlockSamplingData.h diff --git a/FEXCore/Source/CMakeLists.txt b/FEXCore/Source/CMakeLists.txt index 971271a789..0690c870cf 100644 --- a/FEXCore/Source/CMakeLists.txt +++ b/FEXCore/Source/CMakeLists.txt @@ -86,7 +86,6 @@ set (SRCS Common/SoftFloat-3e/s_f32UIToCommonNaN.c Interface/Context/Context.cpp Interface/Core/LookupCache.cpp - Interface/Core/BlockSamplingData.cpp Interface/Core/Core.cpp Interface/Core/CPUBackend.cpp Interface/Core/CPUID.cpp diff --git a/FEXCore/Source/Interface/Context/Context.h b/FEXCore/Source/Interface/Context/Context.h index 7863ed6d4f..b44fff4850 100644 --- a/FEXCore/Source/Interface/Context/Context.h +++ b/FEXCore/Source/Interface/Context/Context.h @@ -260,10 +260,6 @@ class ContextImpl final : public FEXCore::Context::Context { FEXCore::Context::ExitHandler CustomExitHandler; -#ifdef BLOCKSTATS - fextl::unique_ptr BlockData; -#endif - SignalDelegator* SignalDelegation {}; X86GeneratedCode X86CodeGen; diff --git a/FEXCore/Source/Interface/Core/BlockSamplingData.cpp b/FEXCore/Source/Interface/Core/BlockSamplingData.cpp deleted file mode 100644 index 6608633065..0000000000 --- a/FEXCore/Source/Interface/Core/BlockSamplingData.cpp +++ /dev/null @@ -1,51 +0,0 @@ -// SPDX-License-Identifier: MIT -#include "Interface/Core/BlockSamplingData.h" -#include -#include -#include -#include - -namespace FEXCore { -void BlockSamplingData::DumpBlockData() { - std::fstream Output; - Output.open("output.csv", std::fstream::out | std::fstream::binary); - - if (!Output.is_open()) { - return; - } - - Output << "Entry, Min, Max, Total, Calls, Average" << std::endl; - - for (auto it : SamplingMap) { - if (!it.second->TotalCalls) { - continue; - } - - Output << "0x" << std::hex << it.first << ", " << std::dec << it.second->Min << ", " << std::dec << it.second->Max << ", " << std::dec - << it.second->TotalTime << ", " << std::dec << it.second->TotalCalls << ", " << std::dec - << ((double)it.second->TotalTime / (double)it.second->TotalCalls) << std::endl; - } - Output.close(); - LogMan::Msg::DFmt("Dumped {} blocks of sampling data", SamplingMap.size()); -} - -BlockSamplingData::BlockData* BlockSamplingData::GetBlockData(uint64_t RIP) { - auto it = SamplingMap.find(RIP); - if (it != SamplingMap.end()) { - return it->second; - } - BlockData* NewData = new BlockData {}; - memset(NewData, 0, sizeof(BlockData)); - NewData->Min = ~0ULL; - SamplingMap[RIP] = NewData; - return NewData; -} - -BlockSamplingData::~BlockSamplingData() { - DumpBlockData(); - for (auto it : SamplingMap) { - delete it.second; - } - SamplingMap.clear(); -} -} // namespace FEXCore diff --git a/FEXCore/Source/Interface/Core/BlockSamplingData.h b/FEXCore/Source/Interface/Core/BlockSamplingData.h deleted file mode 100644 index 8460d832d6..0000000000 --- a/FEXCore/Source/Interface/Core/BlockSamplingData.h +++ /dev/null @@ -1,25 +0,0 @@ -// SPDX-License-Identifier: MIT -#pragma once - -#include -#include - -namespace FEXCore { -class BlockSamplingData { -public: - struct BlockData { - uint64_t Start, End; - uint64_t Min, Max; - uint64_t TotalTime; - uint64_t TotalCalls; - }; - - BlockData* GetBlockData(uint64_t RIP); - ~BlockSamplingData(); - - void DumpBlockData(); - -private: - std::unordered_map SamplingMap; -}; -} // namespace FEXCore diff --git a/FEXCore/Source/Interface/Core/Core.cpp b/FEXCore/Source/Interface/Core/Core.cpp index 46cedca69b..9408bc9a97 100644 --- a/FEXCore/Source/Interface/Core/Core.cpp +++ b/FEXCore/Source/Interface/Core/Core.cpp @@ -78,9 +78,6 @@ ContextImpl::ContextImpl(const FEXCore::HostFeatures& Features) : HostFeatures {Features} , CPUID {this} , IRCaptureCache {this} { -#ifdef BLOCKSTATS - BlockData = std::make_unique(); -#endif if (Config.CacheObjectCodeCompilation() != FEXCore::Config::ConfigObjectCodeHandler::CONFIG_NONE) { CodeObjectCacheService = fextl::make_unique(this); }