mirror of
https://github.com/RPCSX/rpcsx.git
synced 2026-04-04 14:08:37 +00:00
Implement perf stat counter for PPU/SPU reservation ops
Adds Emu/perf_meter.hpp header file. Uses RDTSC for speed. Prints stats at exit.
This commit is contained in:
parent
adf50b7c4b
commit
120849c734
10 changed files with 281 additions and 8 deletions
58
rpcs3/Emu/perf_meter.cpp
Normal file
58
rpcs3/Emu/perf_meter.cpp
Normal file
|
|
@ -0,0 +1,58 @@
|
|||
#include "stdafx.h"
|
||||
#include "perf_meter.hpp"
|
||||
|
||||
void perf_stat_base::push(u64 ns[66]) noexcept
|
||||
{
|
||||
for (u32 i = 0; i < 66; i++)
|
||||
{
|
||||
m_log[i] += ns[i];
|
||||
}
|
||||
}
|
||||
|
||||
void perf_stat_base::print(const char* name) noexcept
|
||||
{
|
||||
if (u64 num_total = m_log[0].load())
|
||||
{
|
||||
perf_log.notice("Perf stats for %s: total events: %u (total time %.4fs)", name, num_total, m_log[65].load() / 1000'000'000.);
|
||||
|
||||
for (u32 i = 0; i < 13; i++)
|
||||
{
|
||||
if (u64 count = m_log[i + 1].load())
|
||||
{
|
||||
perf_log.notice("Perf stats for %s: events < %.3fµs: %u", name, std::pow(2., i) / 1000., count);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 14; i < 23; i++)
|
||||
{
|
||||
if (u64 count = m_log[i + 1].load()) [[unlikely]]
|
||||
{
|
||||
perf_log.notice("Perf stats for %s: events < %.3fms: %u", name, std::pow(2., i) / 1000'000., count);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 24; i < 33; i++)
|
||||
{
|
||||
if (u64 count = m_log[i + 1].load()) [[unlikely]]
|
||||
{
|
||||
perf_log.notice("Perf stats for %s: events < %.3fs: %u", name, std::pow(2., i) / 1000'000'000., count);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 34; i < 43; i++)
|
||||
{
|
||||
if (u64 count = m_log[i + 1].load()) [[unlikely]]
|
||||
{
|
||||
perf_log.notice("Perf stats for %s: events < %.0f SEC: %u", name, std::pow(2., i) / 1000'000'000., count);
|
||||
}
|
||||
}
|
||||
|
||||
for (u32 i = 44; i < 63; i++)
|
||||
{
|
||||
if (u64 count = m_log[i + 1].load()) [[unlikely]]
|
||||
{
|
||||
perf_log.notice("Perf stats for %s: events < %.0f MIN: %u", name, std::pow(2., i) / 60'000'000'000., count);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue