mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-31 01:15:17 +01:00
JitRegister: Check Open return code
If the call to `Open` a perf map fails don't set `s_is_enabled` (though it could already be true if you're also using VTUNE) and don't call `std::setvbuf` with a null stream. Also fix a typo in a comment (`if` -> `in`)
This commit is contained in:
@@ -42,11 +42,13 @@ void Init(const std::string& perf_dir)
|
||||
{
|
||||
const std::string dir = perf_dir.empty() ? "/tmp" : perf_dir;
|
||||
const std::string filename = fmt::format("{}/perf-{}.map", dir, getpid());
|
||||
s_perf_map_file.Open(filename, "w");
|
||||
// Disable buffering in order to avoid missing some mappings
|
||||
// if the event of a crash:
|
||||
std::setvbuf(s_perf_map_file.GetHandle(), nullptr, _IONBF, 0);
|
||||
s_is_enabled = true;
|
||||
if (s_perf_map_file.Open(filename, "w"))
|
||||
{
|
||||
// Disable buffering in order to avoid missing some mappings
|
||||
// in the event of a crash:
|
||||
std::setvbuf(s_perf_map_file.GetHandle(), nullptr, _IONBF, 0);
|
||||
s_is_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user