mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-02-02 19:12:47 +02:00
Merge pull request #2912 from Tilka/coretiming
CoreTiming: small cleanup
This commit is contained in:
commit
2be69ae747
@ -63,9 +63,6 @@ u64 fakeTBStartTicks;
|
|||||||
|
|
||||||
static int ev_lost;
|
static int ev_lost;
|
||||||
|
|
||||||
|
|
||||||
static void (*advanceCallback)(int cyclesExecuted) = nullptr;
|
|
||||||
|
|
||||||
static Event* GetNewEvent()
|
static Event* GetNewEvent()
|
||||||
{
|
{
|
||||||
if (!eventPool)
|
if (!eventPool)
|
||||||
@ -303,42 +300,13 @@ void ScheduleEvent(int cyclesIntoFuture, int event_type, u64 userdata)
|
|||||||
AddEventToQueue(ne);
|
AddEventToQueue(ne);
|
||||||
}
|
}
|
||||||
|
|
||||||
void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted))
|
|
||||||
{
|
|
||||||
advanceCallback = callback;
|
|
||||||
}
|
|
||||||
|
|
||||||
bool IsScheduled(int event_type)
|
|
||||||
{
|
|
||||||
if (!first)
|
|
||||||
return false;
|
|
||||||
Event *e = first;
|
|
||||||
while (e)
|
|
||||||
{
|
|
||||||
if (e->type == event_type)
|
|
||||||
return true;
|
|
||||||
e = e->next;
|
|
||||||
}
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
void RemoveEvent(int event_type)
|
void RemoveEvent(int event_type)
|
||||||
{
|
{
|
||||||
if (!first)
|
while (first && first->type == event_type)
|
||||||
return;
|
|
||||||
|
|
||||||
while (first)
|
|
||||||
{
|
{
|
||||||
if (first->type == event_type)
|
Event* next = first->next;
|
||||||
{
|
FreeEvent(first);
|
||||||
Event *next = first->next;
|
first = next;
|
||||||
FreeEvent(first);
|
|
||||||
first = next;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!first)
|
if (!first)
|
||||||
@ -368,11 +336,6 @@ void RemoveAllEvents(int event_type)
|
|||||||
RemoveEvent(event_type);
|
RemoveEvent(event_type);
|
||||||
}
|
}
|
||||||
|
|
||||||
void SetMaximumSlice(int maximumSliceLength)
|
|
||||||
{
|
|
||||||
maxSliceLength = maximumSliceLength;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ForceExceptionCheck(int cycles)
|
void ForceExceptionCheck(int cycles)
|
||||||
{
|
{
|
||||||
if (DowncountToCycles(PowerPC::ppcState.downcount) > cycles)
|
if (DowncountToCycles(PowerPC::ppcState.downcount) > cycles)
|
||||||
@ -382,11 +345,6 @@ void ForceExceptionCheck(int cycles)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ResetSliceLength()
|
|
||||||
{
|
|
||||||
maxSliceLength = MAX_SLICE_LENGTH;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
//This raise only the events required while the fifo is processing data
|
//This raise only the events required while the fifo is processing data
|
||||||
void ProcessFifoWaitEvents()
|
void ProcessFifoWaitEvents()
|
||||||
@ -434,21 +392,14 @@ void Advance()
|
|||||||
lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f;
|
lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f;
|
||||||
PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
|
PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
|
||||||
|
|
||||||
while (first)
|
while (first && first->time <= globalTimer)
|
||||||
{
|
{
|
||||||
if (first->time <= globalTimer)
|
//LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
|
||||||
{
|
// event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
|
||||||
//LOG(POWERPC, "[Scheduler] %s (%lld, %lld) ",
|
Event* evt = first;
|
||||||
// event_types[first->type].name ? event_types[first->type].name : "?", (u64)globalTimer, (u64)first->time);
|
first = first->next;
|
||||||
Event* evt = first;
|
event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
|
||||||
first = first->next;
|
FreeEvent(evt);
|
||||||
event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
|
|
||||||
FreeEvent(evt);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!first)
|
if (!first)
|
||||||
@ -463,9 +414,6 @@ void Advance()
|
|||||||
slicelength = maxSliceLength;
|
slicelength = maxSliceLength;
|
||||||
PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
|
PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (advanceCallback)
|
|
||||||
advanceCallback(cyclesExecuted);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void LogPendingEvents()
|
void LogPendingEvents()
|
||||||
|
@ -52,7 +52,6 @@ void ScheduleEvent_Threadsafe_Immediate(int event_type, u64 userdata = 0);
|
|||||||
// We only permit one event of each type in the queue at a time.
|
// We only permit one event of each type in the queue at a time.
|
||||||
void RemoveEvent(int event_type);
|
void RemoveEvent(int event_type);
|
||||||
void RemoveAllEvents(int event_type);
|
void RemoveAllEvents(int event_type);
|
||||||
bool IsScheduled(int event_type);
|
|
||||||
void Advance();
|
void Advance();
|
||||||
void MoveEvents();
|
void MoveEvents();
|
||||||
void ProcessFifoWaitEvents();
|
void ProcessFifoWaitEvents();
|
||||||
@ -64,10 +63,6 @@ void Idle();
|
|||||||
void ClearPendingEvents();
|
void ClearPendingEvents();
|
||||||
|
|
||||||
void LogPendingEvents();
|
void LogPendingEvents();
|
||||||
void SetMaximumSlice(int maximumSliceLength);
|
|
||||||
void ResetSliceLength();
|
|
||||||
|
|
||||||
void RegisterAdvanceCallback(void (*callback)(int cyclesExecuted));
|
|
||||||
|
|
||||||
std::string GetScheduledEventsSummary();
|
std::string GetScheduledEventsSummary();
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user