mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-12 01:38:37 +12:00
rsx: Basic performance counters
This commit is contained in:
parent
2855869530
commit
84b8a08d26
5 changed files with 80 additions and 21 deletions
|
@ -527,12 +527,26 @@ namespace rsx
|
|||
if (put == internal_get || !Emu.IsRunning())
|
||||
{
|
||||
if (has_deferred_call)
|
||||
{
|
||||
flush_command_queue();
|
||||
}
|
||||
else if (!performance_counters.FIFO_is_idle)
|
||||
{
|
||||
performance_counters.FIFO_idle_timestamp = get_system_time();
|
||||
performance_counters.FIFO_is_idle = true;
|
||||
}
|
||||
|
||||
do_internal_task();
|
||||
continue;
|
||||
}
|
||||
|
||||
if (performance_counters.FIFO_is_idle)
|
||||
{
|
||||
//Update performance counters with time spent in idle mode
|
||||
performance_counters.FIFO_is_idle = false;
|
||||
performance_counters.idle_time += (get_system_time() - performance_counters.FIFO_idle_timestamp);
|
||||
}
|
||||
|
||||
//Validate put and get registers
|
||||
//TODO: Who should handle graphics exceptions??
|
||||
const u32 get_address = RSXIOMem.RealAddr(internal_get);
|
||||
|
@ -2027,6 +2041,8 @@ namespace rsx
|
|||
|
||||
skip_frame = (m_skip_frame_ctr < 0);
|
||||
}
|
||||
|
||||
performance_counters.sampled_frames++;
|
||||
}
|
||||
|
||||
void thread::check_zcull_status(bool framebuffer_swap, bool force_read)
|
||||
|
@ -2223,6 +2239,28 @@ namespace rsx
|
|||
external_interrupt_lock.store(false);
|
||||
}
|
||||
|
||||
u32 thread::get_load()
|
||||
{
|
||||
//Average load over around 30 frames
|
||||
if (!performance_counters.last_update_timestamp || performance_counters.sampled_frames > 30)
|
||||
{
|
||||
const auto timestamp = get_system_time();
|
||||
const auto idle = performance_counters.idle_time.load();
|
||||
const auto elapsed = timestamp - performance_counters.last_update_timestamp;
|
||||
|
||||
if (elapsed > idle)
|
||||
performance_counters.approximate_load = (elapsed - idle) * 100 / elapsed;
|
||||
else
|
||||
performance_counters.approximate_load = 0;
|
||||
|
||||
performance_counters.idle_time = 0;
|
||||
performance_counters.sampled_frames = 0;
|
||||
performance_counters.last_update_timestamp = timestamp;
|
||||
}
|
||||
|
||||
return performance_counters.approximate_load;
|
||||
}
|
||||
|
||||
//TODO: Move these helpers into a better class dedicated to shell interface handling (use idm?)
|
||||
//They are not dependent on rsx at all
|
||||
rsx::overlays::save_dialog* thread::shell_open_save_dialog()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue