MCPcopy Create free account
hub / github.com/FEX-Emu/FEX / Shutdown

Function Shutdown

FEXCore/Source/Utils/Telemetry.cpp:56–80  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

54}
55
56void Shutdown(const fextl::string& ApplicationName) {
57 if (!Enabled) {
58 return;
59 }
60
61 auto DataDirectory = Config::GetTelemetryDirectory() + ApplicationName + ".telem";
62
63 // Retain a single backup if the telemetry already existed.
64 auto Backup = DataDirectory + ".bck";
65
66 // Failure on rename is okay.
67 (void)FHU::Filesystem::RenameFile(DataDirectory, Backup);
68
69 auto File = FEXCore::File::File(DataDirectory.c_str(),
70 FEXCore::File::FileModes::WRITE | FEXCore::File::FileModes::CREATE | FEXCore::File::FileModes::TRUNCATE);
71
72 if (File.IsValid()) {
73 for (size_t i = 0; i < TelemetryType::TYPE_LAST; ++i) {
74 auto& Name = TelemetryNames.at(i);
75 auto& Data = TelemetryValues.at(i);
76 fextl::fmt::print(File, "{}: {}\n", Name, Data.load());
77 }
78 File.Flush();
79 }
80}
81
82#endif
83} // namespace FEXCore::Telemetry

Callers

nothing calls this directly

Calls 6

RenameFileFunction · 0.85
FileClass · 0.85
printFunction · 0.85
atMethod · 0.80
FlushMethod · 0.80
IsValidMethod · 0.45

Tested by

no test coverage detected