Skip to content

Commit

Permalink
Merge pull request FEX-Emu#3865 from Sonicadvance1/telemetry_atexit
Browse files Browse the repository at this point in the history
Telemetry: Change how visibility of telemetry values work
  • Loading branch information
Sonicadvance1 authored Jul 15, 2024
2 parents d79b7fc + 97a68cb commit b8e864f
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 7 deletions.
5 changes: 1 addition & 4 deletions FEXCore/Source/Utils/Telemetry.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@

namespace FEXCore::Telemetry {
#ifndef FEX_DISABLE_TELEMETRY
static std::array<Value, FEXCore::Telemetry::TelemetryType::TYPE_LAST> TelemetryValues = {{}};
std::array<Value, FEXCore::Telemetry::TelemetryType::TYPE_LAST> TelemetryValues = {{}};
const std::array<std::string_view, FEXCore::Telemetry::TelemetryType::TYPE_LAST> TelemetryNames {
"64byte Split Locks",
"16byte Split atomics",
Expand Down Expand Up @@ -80,8 +80,5 @@ void Shutdown(const fextl::string& ApplicationName) {
}
}

Value& GetTelemetryValue(TelemetryType Type) {
return TelemetryValues.at(Type);
}
#endif
} // namespace FEXCore::Telemetry
8 changes: 5 additions & 3 deletions FEXCore/include/FEXCore/Utils/Telemetry.h
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@
#include <FEXCore/Utils/CompilerDefs.h>
#include <FEXCore/fextl/string.h>

#include <array>
#include <atomic>
#include <stdint.h>
#include <type_traits>
#include <filesystem>

namespace FEXCore::Telemetry {
enum TelemetryType {
Expand Down Expand Up @@ -64,7 +63,10 @@ class Value final {
std::atomic<uint64_t> Data;
};

FEX_DEFAULT_VISIBILITY Value& GetTelemetryValue(TelemetryType Type);
FEX_DEFAULT_VISIBILITY extern std::array<Value, FEXCore::Telemetry::TelemetryType::TYPE_LAST> TelemetryValues;
inline Value& GetTelemetryValue(TelemetryType Type) {
return FEXCore::Telemetry::TelemetryValues[Type];
}

FEX_DEFAULT_VISIBILITY void Initialize();
FEX_DEFAULT_VISIBILITY void Shutdown(const fextl::string& ApplicationName);
Expand Down

0 comments on commit b8e864f

Please sign in to comment.