mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-03 13:31:27 +12:00
perf_meter.cpp: register only named threads
Can workaround some possible problems.
This commit is contained in:
parent
43a58df8a0
commit
6357b9a04f
1 changed files with 12 additions and 0 deletions
|
@ -2,6 +2,7 @@
|
||||||
#include "perf_meter.hpp"
|
#include "perf_meter.hpp"
|
||||||
|
|
||||||
#include "util/sysinfo.hpp"
|
#include "util/sysinfo.hpp"
|
||||||
|
#include "Utilities/Thread.h"
|
||||||
|
|
||||||
#include <map>
|
#include <map>
|
||||||
#include <mutex>
|
#include <mutex>
|
||||||
|
@ -105,6 +106,12 @@ static std::multimap<std::string, u64*> s_perf_sources;
|
||||||
|
|
||||||
void perf_stat_base::add(u64 ns[66], const char* name) noexcept
|
void perf_stat_base::add(u64 ns[66], const char* name) noexcept
|
||||||
{
|
{
|
||||||
|
// Don't attempt to register some foreign/unnamed threads
|
||||||
|
if (!thread_ctrl::get_current())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(s_perf_mutex);
|
std::lock_guard lock(s_perf_mutex);
|
||||||
|
|
||||||
s_perf_sources.emplace(name, ns);
|
s_perf_sources.emplace(name, ns);
|
||||||
|
@ -113,6 +120,11 @@ void perf_stat_base::add(u64 ns[66], const char* name) noexcept
|
||||||
|
|
||||||
void perf_stat_base::remove(u64 ns[66], const char* name) noexcept
|
void perf_stat_base::remove(u64 ns[66], const char* name) noexcept
|
||||||
{
|
{
|
||||||
|
if (!thread_ctrl::get_current())
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
std::lock_guard lock(s_perf_mutex);
|
std::lock_guard lock(s_perf_mutex);
|
||||||
|
|
||||||
const auto found = s_perf_sources.equal_range(name);
|
const auto found = s_perf_sources.equal_range(name);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue