Trace Scheduler Preemption/Yield in Perfetto

This commit is contained in:
PixelyIon 2022-10-22 17:37:03 +05:30
parent c874907eb5
commit a0539a3edb

View File

@ -15,12 +15,15 @@ namespace skyline::kernel {
void Scheduler::SignalHandler(int signal, siginfo *info, ucontext *ctx, void **tls) { void Scheduler::SignalHandler(int signal, siginfo *info, ucontext *ctx, void **tls) {
if (*tls) { if (*tls) {
TRACE_EVENT_END("guest"); TRACE_EVENT_END("guest");
{
TRACE_EVENT_FMT("scheduler", "{} Signal", signal == PreemptionSignal ? "Preemption" : "Yield");
const auto &state{*reinterpret_cast<nce::ThreadContext *>(*tls)->state}; const auto &state{*reinterpret_cast<nce::ThreadContext *>(*tls)->state};
if (signal == PreemptionSignal) if (signal == PreemptionSignal)
state.thread->isPreempted = false; state.thread->isPreempted = false;
state.scheduler->Rotate(false); state.scheduler->Rotate(false);
YieldPending = false; YieldPending = false;
state.scheduler->WaitSchedule(); state.scheduler->WaitSchedule();
}
TRACE_EVENT_BEGIN("guest", "Guest"); TRACE_EVENT_BEGIN("guest", "Guest");
} else { } else {
YieldPending = true; YieldPending = true;