SHMStats: Adds ThreadStats size to header

Reused the padding area so the header format doesn't change. If it is
non-zero then it should be used by the tool.
This commit is contained in:
Ryan Houdek committed 2025-10-16 14:07:29 -07:00
1 parent 46fc45b952
commit 6ee77eb1a1
2 files changed
+3 -2

No files matched your search

+1 -1
View File
@@ -44,7 +44,7 @@ enum class AppType : uint8_t {
struct ThreadStatsHeader {
uint8_t Version;
AppType app_type;
uint8_t _pad[2];
uint16_t ThreadStatsSize;
char fex_version[48];
std::atomic<uint32_t> Head;
std::atomic<uint32_t> Size;
+2 -1
View File
@@ -13,10 +13,11 @@ void StatAllocBase::SaveHeader(FEXCore::SHMStats::AppType AppType) {
Head = reinterpret_cast<FEXCore::SHMStats::ThreadStatsHeader*>(Base);
Head->Size.store(CurrentSize, std::memory_order_relaxed);
Head->Version = FEXCore::SHMStats::STATS_VERSION;
Head->app_type = AppType;
Head->ThreadStatsSize = sizeof(FEXCore::SHMStats::ThreadStats);
std::string_view GitString = GIT_DESCRIBE_STRING;
strncpy(Head->fex_version, GitString.data(), std::min(GitString.size(), sizeof(Head->fex_version)));
Head->app_type = AppType;
Stats = reinterpret_cast<FEXCore::SHMStats::ThreadStats*>(reinterpret_cast<uint64_t>(Base) + sizeof(FEXCore::SHMStats::ThreadStatsHeader));