mirror of
https://github.com/RPCS3/rpcs3.git
synced 2024-11-17 08:11:51 +00:00
atomic.cpp: print some stats on stop
This commit is contained in:
parent
70761a4ef0
commit
3888b0429c
@ -86,6 +86,11 @@ namespace
|
||||
struct progress_dialog_server;
|
||||
}
|
||||
|
||||
namespace atomic_wait
|
||||
{
|
||||
extern void parse_hashtable(bool(*cb)(u64 id, u16 refs, u32 ptr, u32 stats));
|
||||
}
|
||||
|
||||
template<>
|
||||
void fmt_class_string<game_boot_result>::format(std::string& out, u64 arg)
|
||||
{
|
||||
@ -1875,6 +1880,35 @@ void Emulator::Stop(bool restart)
|
||||
|
||||
jit_runtime::finalize();
|
||||
|
||||
static u64 aw_refs = 0;
|
||||
static u64 aw_colm = 0;
|
||||
static u64 aw_colc = 0;
|
||||
static u64 aw_used = 0;
|
||||
|
||||
aw_refs = 0;
|
||||
aw_colm = 0;
|
||||
aw_colc = 0;
|
||||
aw_used = 0;
|
||||
|
||||
atomic_wait::parse_hashtable([](u64 id, u16 refs, u32 ptr, u32 stats) -> bool
|
||||
{
|
||||
aw_refs += refs;
|
||||
aw_used += ptr != 0;
|
||||
|
||||
stats = (stats & 0xaaaaaaaa) / 2 + (stats & 0x55555555);
|
||||
stats = (stats & 0xcccccccc) / 4 + (stats & 0x33333333);
|
||||
stats = (stats & 0xf0f0f0f0) / 16 + (stats & 0xf0f0f0f);
|
||||
stats = (stats & 0xff00ff00) / 256 + (stats & 0xff00ff);
|
||||
stats = (stats >> 16) + (stats & 0xffff);
|
||||
|
||||
aw_colm = std::max<u64>(aw_colm, stats);
|
||||
aw_colc += stats != 0;
|
||||
|
||||
return false;
|
||||
});
|
||||
|
||||
sys_log.notice("Atomic wait hashtable stats: [in_use=%u, used=%u, max_collision_weight=%u, total_collisions=%u]", aw_refs, aw_used, aw_colm, aw_colc);
|
||||
|
||||
if (restart)
|
||||
{
|
||||
// Reload with prior configs.
|
||||
|
@ -1556,3 +1556,20 @@ atomic_wait_engine::notify_all(const void* data, u32 size, __m128i mask, __m128i
|
||||
|
||||
s_tls_notify_cb(data, -1);
|
||||
}
|
||||
|
||||
namespace atomic_wait
|
||||
{
|
||||
extern void parse_hashtable(bool(*cb)(u64 id, u16 refs, u32 ptr, u32 stats))
|
||||
{
|
||||
for (u64 i = 0; i < s_hashtable_size; i++)
|
||||
{
|
||||
const auto root = &s_hashtable[i];
|
||||
const auto slot = root->bits.load();
|
||||
|
||||
if (cb(i, static_cast<u16>(slot.ref), root->first_ptr.load(), root->diff_lz | root->diff_tz | root->diff_pop))
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user