1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2024-11-22 10:42:36 +01:00

CPU preemption control: Add one more debug variable

This commit is contained in:
Eladash 2022-09-13 21:16:44 +03:00 committed by Ivan
parent 2807be7080
commit 9c5108c1ca
2 changed files with 5 additions and 1 deletions

View File

@ -1211,6 +1211,7 @@ static std::deque<class cpu_thread*> g_to_sleep;
static atomic_t<u64> s_yield_frequency = 0;
static atomic_t<u64> s_max_allowed_yield_tsc = 0;
static u64 s_last_yield_tsc = 0;
atomic_t<u32> g_lv2_preempts_taken = 0;
namespace cpu_counter
{
@ -1676,6 +1677,7 @@ void lv2_obj::schedule_all(u64 current_time)
{
cpu->state += cpu_flag::preempt;
s_last_yield_tsc = tsc;
g_lv2_preempts_taken.release(g_lv2_preempts_taken.load() + 1); // Has a minor race but performance is more important
rsx::set_rsx_yield_flag();
}
}
@ -1768,6 +1770,7 @@ void lv2_obj::set_yield_frequency(u64 freq, u64 max_allowed_tsc)
{
s_yield_frequency.release(freq);
s_max_allowed_yield_tsc.release(max_allowed_tsc);
g_lv2_preempts_taken.release(0);
}
bool lv2_obj::wait_timeout(u64 usec, ppu_thread* cpu, bool scale, bool is_usleep)

View File

@ -42,6 +42,7 @@ rsx::frame_capture_data frame_capture;
extern CellGcmOffsetTable offsetTable;
extern thread_local std::string(*g_tls_log_prefix)();
extern atomic_t<u32> g_lv2_preempts_taken;
LOG_CHANNEL(perf_log, "PERF");
@ -3645,7 +3646,7 @@ namespace rsx
lower_preemption_count();
}
perf_log.trace("CPU preemption control: reeval=%d, preempt_count=%d, fails=%d, hard=%d, avg_frame_time=%d, highered=%d, lowered=%d", can_reevaluate, preempt_count, fails, hard_fails, avg_frame_time, highered_delay, lowered_delay);
perf_log.trace("CPU preemption control: reeval=%d, preempt_count=%d, fails=%d, hard=%d, avg_frame_time=%d, highered=%d, lowered=%d, taken=%u", can_reevaluate, preempt_count, fails, hard_fails, avg_frame_time, highered_delay, lowered_delay, ::g_lv2_preempts_taken.load());
if (hard_measures_taken)
{