mirror of
https://github.com/FEX-Emu/FEX.git
synced 2026-10-15 07:00:42 +02:00
Whole-tree reformat
This follows discussions from #3413. Followup commits add clang-format file, script and blame ignore lists.
This commit is contained in:
1 parent
028c220041
commit
2b4ec88dae
447 files changed
+78590
-73070
No files matched your search
@@ -16,75 +16,72 @@
|
||||
|
||||
namespace FEXCore::Telemetry {
|
||||
#ifndef FEX_DISABLE_TELEMETRY
|
||||
static 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",
|
||||
"VEX instructions (AVX)",
|
||||
"EVEX instructions (AVX512)",
|
||||
"16bit CAS Tear",
|
||||
"32bit CAS Tear",
|
||||
"64bit CAS Tear",
|
||||
"128bit CAS Tear",
|
||||
"Crash mask",
|
||||
"Write 32-bit Segment ES",
|
||||
"Write 32-bit Segment SS",
|
||||
"Write 32-bit Segment CS",
|
||||
"Write 32-bit Segment DS",
|
||||
"Uses 32-bit Segment ES",
|
||||
"Uses 32-bit Segment SS",
|
||||
"Uses 32-bit Segment CS",
|
||||
"Uses 32-bit Segment DS",
|
||||
"Non-Canonical 64-bit address access",
|
||||
};
|
||||
static 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",
|
||||
"VEX instructions (AVX)",
|
||||
"EVEX instructions (AVX512)",
|
||||
"16bit CAS Tear",
|
||||
"32bit CAS Tear",
|
||||
"64bit CAS Tear",
|
||||
"128bit CAS Tear",
|
||||
"Crash mask",
|
||||
"Write 32-bit Segment ES",
|
||||
"Write 32-bit Segment SS",
|
||||
"Write 32-bit Segment CS",
|
||||
"Write 32-bit Segment DS",
|
||||
"Uses 32-bit Segment ES",
|
||||
"Uses 32-bit Segment SS",
|
||||
"Uses 32-bit Segment CS",
|
||||
"Uses 32-bit Segment DS",
|
||||
"Non-Canonical 64-bit address access",
|
||||
};
|
||||
|
||||
static bool Enabled {true};
|
||||
void Initialize() {
|
||||
FEX_CONFIG_OPT(DisableTelemetry, DISABLETELEMETRY);
|
||||
if (DisableTelemetry) {
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
auto DataDirectory = Config::GetTelemetryDirectory();
|
||||
|
||||
// Ensure the folder structure is created for our configuration
|
||||
if (!FHU::Filesystem::Exists(DataDirectory) &&
|
||||
!FHU::Filesystem::CreateDirectories(DataDirectory)) {
|
||||
LogMan::Msg::IFmt("Couldn't create telemetry Folder");
|
||||
}
|
||||
static bool Enabled {true};
|
||||
void Initialize() {
|
||||
FEX_CONFIG_OPT(DisableTelemetry, DISABLETELEMETRY);
|
||||
if (DisableTelemetry) {
|
||||
Enabled = false;
|
||||
return;
|
||||
}
|
||||
|
||||
void Shutdown(fextl::string const &ApplicationName) {
|
||||
if (!Enabled) {
|
||||
return;
|
||||
}
|
||||
auto DataDirectory = Config::GetTelemetryDirectory();
|
||||
|
||||
auto DataDirectory = Config::GetTelemetryDirectory() + ApplicationName + ".telem";
|
||||
|
||||
// Retain a single backup if the telemetry already existed.
|
||||
auto Backup = DataDirectory + ".bck";
|
||||
|
||||
// Failure on rename is okay.
|
||||
(void)FHU::Filesystem::RenameFile(DataDirectory, Backup);
|
||||
|
||||
auto File = FEXCore::File::File(DataDirectory.c_str(),
|
||||
FEXCore::File::FileModes::WRITE |
|
||||
FEXCore::File::FileModes::CREATE |
|
||||
FEXCore::File::FileModes::TRUNCATE);
|
||||
|
||||
if (File.IsValid()) {
|
||||
for (size_t i = 0; i < TelemetryType::TYPE_LAST; ++i) {
|
||||
auto &Name = TelemetryNames.at(i);
|
||||
auto &Data = TelemetryValues.at(i);
|
||||
fextl::fmt::print(File, "{}: {}\n", Name, *Data);
|
||||
}
|
||||
File.Flush();
|
||||
}
|
||||
// Ensure the folder structure is created for our configuration
|
||||
if (!FHU::Filesystem::Exists(DataDirectory) && !FHU::Filesystem::CreateDirectories(DataDirectory)) {
|
||||
LogMan::Msg::IFmt("Couldn't create telemetry Folder");
|
||||
}
|
||||
|
||||
Value &GetTelemetryValue(TelemetryType Type) {
|
||||
return TelemetryValues.at(Type);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
void Shutdown(const fextl::string& ApplicationName) {
|
||||
if (!Enabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
auto DataDirectory = Config::GetTelemetryDirectory() + ApplicationName + ".telem";
|
||||
|
||||
// Retain a single backup if the telemetry already existed.
|
||||
auto Backup = DataDirectory + ".bck";
|
||||
|
||||
// Failure on rename is okay.
|
||||
(void)FHU::Filesystem::RenameFile(DataDirectory, Backup);
|
||||
|
||||
auto File = FEXCore::File::File(DataDirectory.c_str(),
|
||||
FEXCore::File::FileModes::WRITE | FEXCore::File::FileModes::CREATE | FEXCore::File::FileModes::TRUNCATE);
|
||||
|
||||
if (File.IsValid()) {
|
||||
for (size_t i = 0; i < TelemetryType::TYPE_LAST; ++i) {
|
||||
auto& Name = TelemetryNames.at(i);
|
||||
auto& Data = TelemetryValues.at(i);
|
||||
fextl::fmt::print(File, "{}: {}\n", Name, *Data);
|
||||
}
|
||||
File.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
Value& GetTelemetryValue(TelemetryType Type) {
|
||||
return TelemetryValues.at(Type);
|
||||
}
|
||||
#endif
|
||||
} // namespace FEXCore::Telemetry
|
||||
Reference in new issue
Block a user