perf_map: Use std::string_view instead of std::string for PerfMapRegister()
We can just use a non-owning view into a string in this case instead of potentially allocating a std::string instance.
This commit is contained in:
parent
12243692f5
commit
c39ea2e3c9
2 changed files with 5 additions and 4 deletions
|
@ -45,7 +45,7 @@ void OpenFile() {
|
||||||
} // anonymous namespace
|
} // anonymous namespace
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
void PerfMapRegister(const void* start, const void* end, const std::string& friendly_name) {
|
void PerfMapRegister(const void* start, const void* end, std::string_view friendly_name) {
|
||||||
std::lock_guard guard{mutex};
|
std::lock_guard guard{mutex};
|
||||||
|
|
||||||
if (!file) {
|
if (!file) {
|
||||||
|
@ -79,7 +79,7 @@ void PerfMapClear() {
|
||||||
namespace Dynarmic::BackendX64 {
|
namespace Dynarmic::BackendX64 {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
void PerfMapRegister(const void*, const void*, const std::string&) {}
|
void PerfMapRegister(const void*, const void*, std::string_view) {}
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
void PerfMapClear() {}
|
void PerfMapClear() {}
|
||||||
|
|
|
@ -8,17 +8,18 @@
|
||||||
|
|
||||||
#include <cstddef>
|
#include <cstddef>
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <string_view>
|
||||||
|
|
||||||
#include "common/cast_util.h"
|
#include "common/cast_util.h"
|
||||||
|
|
||||||
namespace Dynarmic::BackendX64 {
|
namespace Dynarmic::BackendX64 {
|
||||||
|
|
||||||
namespace detail {
|
namespace detail {
|
||||||
void PerfMapRegister(const void* start, const void* end, const std::string& friendly_name);
|
void PerfMapRegister(const void* start, const void* end, std::string_view friendly_name);
|
||||||
} // namespace detail
|
} // namespace detail
|
||||||
|
|
||||||
template<typename T>
|
template<typename T>
|
||||||
void PerfMapRegister(T start, const void* end, const std::string& friendly_name) {
|
void PerfMapRegister(T start, const void* end, std::string_view friendly_name) {
|
||||||
detail::PerfMapRegister(Common::BitCast<const void*>(start), end, friendly_name);
|
detail::PerfMapRegister(Common::BitCast<const void*>(start), end, friendly_name);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue