mirror of
https://github.com/FEX-Emu/FEX.git
synced 2025-02-07 15:09:05 +00:00
FEXCore: Allows disabling telemetry at runtime
This is useful for InstCountCI so you can disable the telemetry gathering even if enabled so it doesn't affect the CI system.
This commit is contained in:
parent
02b891c0fe
commit
81a32c3998
4
.github/workflows/instcountci.yml
vendored
4
.github/workflows/instcountci.yml
vendored
@ -64,11 +64,13 @@ jobs:
|
|||||||
# Note the current convention is to use the -S and -B options here to specify source
|
# Note the current convention is to use the -S and -B options here to specify source
|
||||||
# and build directories, but this is only available with CMake 3.13 and higher.
|
# and build directories, but this is only available with CMake 3.13 and higher.
|
||||||
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
# The CMake binaries on the Github Actions machines are (as of this writing) 3.12
|
||||||
run: cmake $GITHUB_WORKSPACE -DENABLE_OFFLINE_TELEMETRY=False -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DENABLE_VIXL_SIMULATOR=False -DENABLE_VIXL_DISASSEMBLER=True -DENABLE_LTO=False -DENABLE_ASSERTIONS=True
|
run: cmake $GITHUB_WORKSPACE -DCMAKE_BUILD_TYPE=$BUILD_TYPE -G Ninja -DENABLE_VIXL_SIMULATOR=False -DENABLE_VIXL_DISASSEMBLER=True -DENABLE_LTO=False -DENABLE_ASSERTIONS=True
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
working-directory: ${{runner.workspace}}/build
|
working-directory: ${{runner.workspace}}/build
|
||||||
shell: bash
|
shell: bash
|
||||||
|
env:
|
||||||
|
FEX_DISABLETELEMETRY: 1
|
||||||
# Execute the build. You can specify a specific target with "--target <NAME>"
|
# Execute the build. You can specify a specific target with "--target <NAME>"
|
||||||
run: cmake --build . --config $BUILD_TYPE --target CodeSizeValidation instcountci_test_files
|
run: cmake --build . --config $BUILD_TYPE --target CodeSizeValidation instcountci_test_files
|
||||||
|
|
||||||
|
@ -329,6 +329,14 @@
|
|||||||
"Allows overriding the SVE width in the vixl simulator.",
|
"Allows overriding the SVE width in the vixl simulator.",
|
||||||
"Useful as a debugging feature."
|
"Useful as a debugging feature."
|
||||||
]
|
]
|
||||||
|
},
|
||||||
|
"DisableTelemetry": {
|
||||||
|
"Type": "bool",
|
||||||
|
"Default": "false",
|
||||||
|
"Desc": [
|
||||||
|
"Disables telemetry at runtime.",
|
||||||
|
"Useful for CI instcountCI mostly"
|
||||||
|
]
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"Logging": {
|
"Logging": {
|
||||||
|
@ -238,6 +238,7 @@ namespace FEXCore::Context {
|
|||||||
FEX_CONFIG_OPT(ParanoidTSO, PARANOIDTSO);
|
FEX_CONFIG_OPT(ParanoidTSO, PARANOIDTSO);
|
||||||
FEX_CONFIG_OPT(CacheObjectCodeCompilation, CACHEOBJECTCODECOMPILATION);
|
FEX_CONFIG_OPT(CacheObjectCodeCompilation, CACHEOBJECTCODECOMPILATION);
|
||||||
FEX_CONFIG_OPT(x87ReducedPrecision, X87REDUCEDPRECISION);
|
FEX_CONFIG_OPT(x87ReducedPrecision, X87REDUCEDPRECISION);
|
||||||
|
FEX_CONFIG_OPT(DisableTelemetry, DISABLETELEMETRY);
|
||||||
} Config;
|
} Config;
|
||||||
|
|
||||||
FEXCore::HostFeatures HostFeatures;
|
FEXCore::HostFeatures HostFeatures;
|
||||||
|
@ -4858,6 +4858,11 @@ void OpDispatchBuilder::CheckLegacySegmentRead(OrderedNode *NewNode, uint32_t Se
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CTX->Config.DisableTelemetry()) {
|
||||||
|
// Telemetry disabled at runtime.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FEXCore::Telemetry::TelemetryType TelemIndex{};
|
FEXCore::Telemetry::TelemetryType TelemIndex{};
|
||||||
switch (SegmentReg) {
|
switch (SegmentReg) {
|
||||||
case FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX:
|
case FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX:
|
||||||
@ -4892,6 +4897,11 @@ void OpDispatchBuilder::CheckLegacySegmentWrite(OrderedNode *NewNode, uint32_t S
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (CTX->Config.DisableTelemetry()) {
|
||||||
|
// Telemetry disabled at runtime.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
FEXCore::Telemetry::TelemetryType TelemIndex{};
|
FEXCore::Telemetry::TelemetryType TelemIndex{};
|
||||||
switch (SegmentReg) {
|
switch (SegmentReg) {
|
||||||
case FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX:
|
case FEXCore::X86Tables::DecodeFlags::FLAG_ES_PREFIX:
|
||||||
|
@ -33,7 +33,15 @@ namespace FEXCore::Telemetry {
|
|||||||
"Uses 32-bit Segment CS",
|
"Uses 32-bit Segment CS",
|
||||||
"Uses 32-bit Segment DS",
|
"Uses 32-bit Segment DS",
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool Enabled {true};
|
||||||
void Initialize() {
|
void Initialize() {
|
||||||
|
FEX_CONFIG_OPT(DisableTelemetry, DISABLETELEMETRY);
|
||||||
|
if (DisableTelemetry) {
|
||||||
|
Enabled = false;
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto DataDirectory = Config::GetDataDirectory();
|
auto DataDirectory = Config::GetDataDirectory();
|
||||||
DataDirectory += "Telemetry/";
|
DataDirectory += "Telemetry/";
|
||||||
|
|
||||||
@ -45,6 +53,10 @@ namespace FEXCore::Telemetry {
|
|||||||
}
|
}
|
||||||
|
|
||||||
void Shutdown(fextl::string const &ApplicationName) {
|
void Shutdown(fextl::string const &ApplicationName) {
|
||||||
|
if (!Enabled) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
auto DataDirectory = Config::GetDataDirectory();
|
auto DataDirectory = Config::GetDataDirectory();
|
||||||
DataDirectory += "Telemetry/" + ApplicationName + ".telem";
|
DataDirectory += "Telemetry/" + ApplicationName + ".telem";
|
||||||
|
|
||||||
|
@ -239,9 +239,7 @@ namespace FEXCore::Core {
|
|||||||
uint64_t FallbackHandlerPointers[FallbackHandlerIndex::OPINDEX_MAX];
|
uint64_t FallbackHandlerPointers[FallbackHandlerIndex::OPINDEX_MAX];
|
||||||
uint64_t NamedVectorConstantPointers[FEXCore::IR::NamedVectorConstant::NAMED_VECTOR_MAX];
|
uint64_t NamedVectorConstantPointers[FEXCore::IR::NamedVectorConstant::NAMED_VECTOR_MAX];
|
||||||
uint64_t IndexedNamedVectorConstantPointers[FEXCore::IR::IndexNamedVectorConstant::INDEXED_NAMED_VECTOR_MAX];
|
uint64_t IndexedNamedVectorConstantPointers[FEXCore::IR::IndexNamedVectorConstant::INDEXED_NAMED_VECTOR_MAX];
|
||||||
#ifndef FEX_DISABLE_TELEMETRY
|
|
||||||
uint64_t TelemetryValueAddresses[FEXCore::Telemetry::TYPE_LAST];
|
uint64_t TelemetryValueAddresses[FEXCore::Telemetry::TYPE_LAST];
|
||||||
#endif
|
|
||||||
|
|
||||||
// Thread Specific
|
// Thread Specific
|
||||||
/**
|
/**
|
||||||
|
@ -9,25 +9,6 @@
|
|||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
|
|
||||||
namespace FEXCore::Telemetry {
|
namespace FEXCore::Telemetry {
|
||||||
#ifndef FEX_DISABLE_TELEMETRY
|
|
||||||
class Value;
|
|
||||||
|
|
||||||
class Value final {
|
|
||||||
public:
|
|
||||||
Value() = default;
|
|
||||||
Value(uint64_t Default) : Data {Default} {}
|
|
||||||
|
|
||||||
uint64_t operator*() const { return Data; }
|
|
||||||
void operator=(uint64_t Value) { Data = Value; }
|
|
||||||
void operator|=(uint64_t Value) { Data |= Value; }
|
|
||||||
void operator++(int) { Data++; }
|
|
||||||
|
|
||||||
std::atomic<uint64_t> *GetAddr() { return &Data; }
|
|
||||||
|
|
||||||
private:
|
|
||||||
std::atomic<uint64_t> Data;
|
|
||||||
};
|
|
||||||
|
|
||||||
enum TelemetryType {
|
enum TelemetryType {
|
||||||
TYPE_HAS_SPLIT_LOCKS,
|
TYPE_HAS_SPLIT_LOCKS,
|
||||||
TYPE_16BYTE_SPLIT,
|
TYPE_16BYTE_SPLIT,
|
||||||
@ -51,6 +32,25 @@ namespace FEXCore::Telemetry {
|
|||||||
TYPE_LAST,
|
TYPE_LAST,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#ifndef FEX_DISABLE_TELEMETRY
|
||||||
|
class Value;
|
||||||
|
|
||||||
|
class Value final {
|
||||||
|
public:
|
||||||
|
Value() = default;
|
||||||
|
Value(uint64_t Default) : Data {Default} {}
|
||||||
|
|
||||||
|
uint64_t operator*() const { return Data; }
|
||||||
|
void operator=(uint64_t Value) { Data = Value; }
|
||||||
|
void operator|=(uint64_t Value) { Data |= Value; }
|
||||||
|
void operator++(int) { Data++; }
|
||||||
|
|
||||||
|
std::atomic<uint64_t> *GetAddr() { return &Data; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::atomic<uint64_t> Data;
|
||||||
|
};
|
||||||
|
|
||||||
FEX_DEFAULT_VISIBILITY Value &GetTelemetryValue(TelemetryType Type);
|
FEX_DEFAULT_VISIBILITY Value &GetTelemetryValue(TelemetryType Type);
|
||||||
|
|
||||||
FEX_DEFAULT_VISIBILITY void Initialize();
|
FEX_DEFAULT_VISIBILITY void Initialize();
|
||||||
|
@ -377,6 +377,8 @@ int main(int argc, char **argv, char **const envp) {
|
|||||||
FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_DISASSEMBLE, fextl::fmt::format("{}", static_cast<uint64_t>(FEXCore::Config::Disassemble::BLOCKS | FEXCore::Config::Disassemble::STATS)));
|
FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_DISASSEMBLE, fextl::fmt::format("{}", static_cast<uint64_t>(FEXCore::Config::Disassemble::BLOCKS | FEXCore::Config::Disassemble::STATS)));
|
||||||
// Choose bitness.
|
// Choose bitness.
|
||||||
FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_IS64BIT_MODE, TestHeaderData->Bitness == 64 ? "1" : "0");
|
FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_IS64BIT_MODE, TestHeaderData->Bitness == 64 ? "1" : "0");
|
||||||
|
// Disable telemetry, it can affect instruction counts.
|
||||||
|
FEXCore::Config::EraseSet(FEXCore::Config::CONFIG_DISABLETELEMETRY, "1");
|
||||||
|
|
||||||
// Host feature override. Only supports overriding SVE width.
|
// Host feature override. Only supports overriding SVE width.
|
||||||
enum HostFeatures {
|
enum HostFeatures {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user