mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2026-01-31 01:15:17 +01:00
Merge pull request #14292 from Dentomologist/jitregister_fix_isenabled_when_using_vtune_without_perf
JitRegister: Fix IsEnabled when using VTune without perf
This commit is contained in:
@@ -34,16 +34,22 @@ static bool s_is_enabled = false;
|
||||
|
||||
void Init(const std::string& perf_dir)
|
||||
{
|
||||
#ifdef USE_VTUNE
|
||||
s_is_enabled = true;
|
||||
#endif
|
||||
|
||||
if (!perf_dir.empty() || getenv("PERF_BUILDID_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");
|
||||
if (s_perf_map_file.Open(filename, "w"))
|
||||
{
|
||||
// Disable buffering in order to avoid missing some mappings
|
||||
// if the event of a crash:
|
||||
// in the event of a crash:
|
||||
std::setvbuf(s_perf_map_file.GetHandle(), nullptr, _IONBF, 0);
|
||||
s_is_enabled = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void Shutdown()
|
||||
@@ -75,7 +81,7 @@ void Register(const void* base_address, u32 code_size, const std::string& symbol
|
||||
#endif
|
||||
|
||||
// Linux perf /tmp/perf-$pid.map:
|
||||
if (!s_perf_map_file.IsOpen())
|
||||
if (!s_perf_map_file)
|
||||
return;
|
||||
|
||||
const auto entry = fmt::format("{} {:x} {}\n", fmt::ptr(base_address), code_size, symbol_name);
|
||||
|
||||
Reference in New Issue
Block a user