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) {
if (*tls) {
TRACE_EVENT_END("guest");
const auto &state{*reinterpret_cast<nce::ThreadContext *>(*tls)->state};
if (signal == PreemptionSignal)
state.thread->isPreempted = false;
state.scheduler->Rotate(false);
YieldPending = false;
state.scheduler->WaitSchedule();
{
TRACE_EVENT_FMT("scheduler", "{} Signal", signal == PreemptionSignal ? "Preemption" : "Yield");
const auto &state{*reinterpret_cast<nce::ThreadContext *>(*tls)->state};
if (signal == PreemptionSignal)
state.thread->isPreempted = false;
state.scheduler->Rotate(false);
YieldPending = false;
state.scheduler->WaitSchedule();
}
TRACE_EVENT_BEGIN("guest", "Guest");
} else {
YieldPending = true;