summaryrefslogtreecommitdiff
path: root/Source/Core/Common/JitRegister.cpp
diff options
context:
space:
mode:
authorAnthony <Helios747@users.noreply.github.com>2019-06-14 12:22:16 -0700
committerGitHub <noreply@github.com>2019-06-14 12:22:16 -0700
commit9cf6ba13dfa04e2ef402eef19cd67435e6849d29 (patch)
treeb87080969dd47a01c3a7845d65ef2afdef90928d /Source/Core/Common/JitRegister.cpp
parent59155b4d5ef891597294b22c1dab581d47c3ea0d (diff)
parent5b92d5076a0be89945fa0fc722749dd5fbfcdf4c (diff)
Merge pull request #8177 from lioncash/fmt
Common: Use fmt where applicable
Diffstat (limited to 'Source/Core/Common/JitRegister.cpp')
-rw-r--r--Source/Core/Common/JitRegister.cpp25
1 files changed, 13 insertions, 12 deletions
diff --git a/Source/Core/Common/JitRegister.cpp b/Source/Core/Common/JitRegister.cpp
index 089eb1cd08..1dcf999f3a 100644
--- a/Source/Core/Common/JitRegister.cpp
+++ b/Source/Core/Common/JitRegister.cpp
@@ -2,16 +2,18 @@
// Licensed under GPLv2+
// Refer to the license.txt file included.
-#include <cinttypes>
+#include "Common/JitRegister.h"
+
#include <cstddef>
#include <cstdio>
#include <cstdlib>
#include <fstream>
#include <string>
+#include <fmt/format.h>
+
#include "Common/CommonTypes.h"
#include "Common/File.h"
-#include "Common/JitRegister.h"
#include "Common/StringUtil.h"
#ifdef _WIN32
@@ -48,8 +50,8 @@ void Init(const std::string& perf_dir)
if (!perf_dir.empty() || getenv("PERF_BUILDID_DIR"))
{
- std::string dir = perf_dir.empty() ? "/tmp" : perf_dir;
- std::string filename = StringFromFormat("%s/perf-%d.map", dir.data(), getpid());
+ 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:
@@ -90,7 +92,7 @@ void RegisterV(const void* base_address, u32 code_size, const char* format, va_l
std::string symbol_name = StringFromFormatV(format, args);
#if defined USE_OPROFILE && USE_OPROFILE
- op_write_native_code(s_agent, symbol_name.data(), (u64)base_address, base_address, code_size);
+ op_write_native_code(s_agent, symbol_name.c_str(), (u64)base_address, base_address, code_size);
#endif
#ifdef USE_VTUNE
@@ -98,16 +100,15 @@ void RegisterV(const void* base_address, u32 code_size, const char* format, va_l
jmethod.method_id = iJIT_GetNewMethodID();
jmethod.method_load_address = const_cast<void*>(base_address);
jmethod.method_size = code_size;
- jmethod.method_name = const_cast<char*>(symbol_name.data());
+ jmethod.method_name = const_cast<char*>(symbol_name.c_str());
iJIT_NotifyEvent(iJVM_EVENT_TYPE_METHOD_LOAD_FINISHED, (void*)&jmethod);
#endif
// Linux perf /tmp/perf-$pid.map:
- if (s_perf_map_file.IsOpen())
- {
- std::string entry =
- StringFromFormat("%" PRIx64 " %x %s\n", (u64)base_address, code_size, symbol_name.data());
- s_perf_map_file.WriteBytes(entry.data(), entry.size());
- }
+ if (!s_perf_map_file.IsOpen())
+ return;
+
+ const auto entry = fmt::format("{} {:x} {}\n", fmt::ptr(base_address), code_size, symbol_name);
+ s_perf_map_file.WriteBytes(entry.data(), entry.size());
}
} // namespace JitRegister