Example #1
0
void Advance()
{
	int cyclesExecuted = slicelength - currentMIPS->downcount;
	globalTimer += cyclesExecuted;
	currentMIPS->downcount = slicelength;

	if (Common::AtomicLoadAcquire(hasTsEvents))
		MoveEvents();
	ProcessFifoWaitEvents();

	if (!first)
	{
		// WARN_LOG(TIMER, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");
		currentMIPS->downcount += 10000;
		slicelength = 10000;
	}
	else
	{
		slicelength = (int)(first->time - globalTimer);
		if (slicelength > MAX_SLICE_LENGTH)
			slicelength = MAX_SLICE_LENGTH;
		currentMIPS->downcount = slicelength;
	}
	if (advanceCallback)
		advanceCallback(cyclesExecuted);
}
Example #2
0
void Advance()
{
	int cyclesExecuted = slicelength - currentMIPS->downcount;
	globalTimer += cyclesExecuted;
	currentMIPS->downcount = slicelength;

	if (Common::AtomicLoadAcquire(hasTsEvents))
		MoveEvents();
	ProcessFifoWaitEvents();

	if (!first)
	{
		// This should never happen in PPSSPP.
		// WARN_LOG_REPORT(TIME, "WARNING - no events in queue. Setting currentMIPS->downcount to 10000");
		if (slicelength < 10000) {
			slicelength += 10000;
			currentMIPS->downcount += slicelength;
		}
	}
	else
	{
		// Note that events can eat cycles as well.
		int target = (int)(first->time - globalTimer);
		if (target > MAX_SLICE_LENGTH)
			target = MAX_SLICE_LENGTH;

		const int diff = target - slicelength;
		slicelength += diff;
		currentMIPS->downcount += diff;
	}
	if (advanceCallback)
		advanceCallback(cyclesExecuted);
}
Example #3
0
void Advance()
{
	MoveEvents();

	int cyclesExecuted = slicelength - DowncountToCycles(PowerPC::ppcState.downcount);
	globalTimer += cyclesExecuted;
	lastOCFactor = SConfig::GetInstance().m_OCEnable ? SConfig::GetInstance().m_OCFactor : 1.0f;
	PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);

	while (first)
	{
		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);
			Event* evt = first;
			first = first->next;
			event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
			FreeEvent(evt);
		}
		else
		{
			break;
		}
	}

	if (!first)
	{
		WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
		PowerPC::ppcState.downcount += CyclesToDowncount(10000);
	}
	else
	{
		slicelength = (int)(first->time - globalTimer);
		if (slicelength > maxSliceLength)
			slicelength = maxSliceLength;
		PowerPC::ppcState.downcount = CyclesToDowncount(slicelength);
	}

	if (advanceCallback)
		advanceCallback(cyclesExecuted);
}
Example #4
0
void Advance()
{
	MoveEvents();

	int cyclesExecuted = slicelength - downcount;
	globalTimer += cyclesExecuted;
	downcount = slicelength;

	while (first)
	{
		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);
			Event* evt = first;
			first = first->next;
			event_types[evt->type].callback(evt->userdata, (int)(globalTimer - evt->time));
			FreeEvent(evt);
		}
		else
		{
			break;
		}
	}

	if (!first)
	{
		WARN_LOG(POWERPC, "WARNING - no events in queue. Setting downcount to 10000");
		downcount += 10000;
	}
	else
	{
		slicelength = (int)(first->time - globalTimer);
		if (slicelength > maxSliceLength)
			slicelength = maxSliceLength;
		downcount = slicelength;
	}

	if (advanceCallback)
		advanceCallback(cyclesExecuted);
}
Example #5
0
void Advance()
{
	int cyclesExecuted = slicelength - downcount;
	globalTimer += cyclesExecuted;
	downcount = slicelength;

	ProcessFifoWaitEvents();

	if (!first)
	{
		// WARN_LOG(CPU, "WARNING - no events in queue. Setting downcount to 10000");
		downcount += 10000;
	}
	else
	{
		slicelength = (int)(first->time - globalTimer);
		if (slicelength > MAX_SLICE_LENGTH)
			slicelength = MAX_SLICE_LENGTH;
		downcount = slicelength;
	}
	if (advanceCallback)
		advanceCallback(cyclesExecuted);
}