mirror of
https://github.com/Ryujinx/Ryujinx.git
synced 2025-01-11 22:06:01 +00:00
Print more information about the rejit queue
This commit is contained in:
parent
ac7006218d
commit
883faaff01
1 changed files with 13 additions and 2 deletions
|
@ -23,6 +23,8 @@ namespace ARMeilleure.Translation
|
||||||
public class Translator
|
public class Translator
|
||||||
{
|
{
|
||||||
private long _nextUpdate;
|
private long _nextUpdate;
|
||||||
|
private long _requestAdded;
|
||||||
|
private long _requestRemoved;
|
||||||
|
|
||||||
private readonly IJitMemoryAllocator _allocator;
|
private readonly IJitMemoryAllocator _allocator;
|
||||||
private readonly IMemoryManager _memory;
|
private readonly IMemoryManager _memory;
|
||||||
|
@ -75,6 +77,8 @@ namespace ARMeilleure.Translation
|
||||||
if (_backgroundStack.TryPop(out RejitRequest request) &&
|
if (_backgroundStack.TryPop(out RejitRequest request) &&
|
||||||
_backgroundSet.TryRemove(request.Address, out _))
|
_backgroundSet.TryRemove(request.Address, out _))
|
||||||
{
|
{
|
||||||
|
Interlocked.Increment(ref _requestRemoved);
|
||||||
|
|
||||||
TranslatedFunction func = Translate(
|
TranslatedFunction func = Translate(
|
||||||
_memory,
|
_memory,
|
||||||
_jumpTable,
|
_jumpTable,
|
||||||
|
@ -110,8 +114,10 @@ namespace ARMeilleure.Translation
|
||||||
{
|
{
|
||||||
Ryujinx.Common.Logging.Logger.Info?.Print(
|
Ryujinx.Common.Logging.Logger.Info?.Print(
|
||||||
Ryujinx.Common.Logging.LogClass.Cpu,
|
Ryujinx.Common.Logging.LogClass.Cpu,
|
||||||
$"{_backgroundStack.Count} rejit requests remaining");
|
$"{_backgroundStack.Count} rejit requests remaining (+{_requestAdded}:-{_requestRemoved}).");
|
||||||
|
|
||||||
|
_requestAdded = 0;
|
||||||
|
_requestRemoved = 0;
|
||||||
_nextUpdate = now + Stopwatch.Frequency * 30;
|
_nextUpdate = now + Stopwatch.Frequency * 30;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -417,6 +423,8 @@ namespace ARMeilleure.Translation
|
||||||
|
|
||||||
internal static void EmitRejitCheck(ArmEmitterContext context, out Counter<uint> counter)
|
internal static void EmitRejitCheck(ArmEmitterContext context, out Counter<uint> counter)
|
||||||
{
|
{
|
||||||
|
const int MinsCallForRejit = 100;
|
||||||
|
|
||||||
if (!Counter<uint>.TryCreate(context.CountTable, out counter))
|
if (!Counter<uint>.TryCreate(context.CountTable, out counter))
|
||||||
{
|
{
|
||||||
return;
|
return;
|
||||||
|
@ -428,7 +436,7 @@ namespace ARMeilleure.Translation
|
||||||
Operand curCount = context.Load(OperandType.I32, address);
|
Operand curCount = context.Load(OperandType.I32, address);
|
||||||
Operand count = context.Add(curCount, Const(1));
|
Operand count = context.Add(curCount, Const(1));
|
||||||
context.Store(address, count);
|
context.Store(address, count);
|
||||||
context.BranchIf(lblEnd, curCount, Const(100), Comparison.NotEqual, BasicBlockFrequency.Cold);
|
context.BranchIf(lblEnd, curCount, Const(MinsCallForRejit), Comparison.NotEqual, BasicBlockFrequency.Cold);
|
||||||
|
|
||||||
context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.EnqueueForRejit)), Const(context.EntryAddress));
|
context.Call(typeof(NativeInterface).GetMethod(nameof(NativeInterface.EnqueueForRejit)), Const(context.EntryAddress));
|
||||||
|
|
||||||
|
@ -470,6 +478,7 @@ namespace ARMeilleure.Translation
|
||||||
{
|
{
|
||||||
if (_backgroundSet.TryAdd(guestAddress, null))
|
if (_backgroundSet.TryAdd(guestAddress, null))
|
||||||
{
|
{
|
||||||
|
Interlocked.Increment(ref _requestAdded);
|
||||||
_backgroundStack.Push(new RejitRequest(guestAddress, mode));
|
_backgroundStack.Push(new RejitRequest(guestAddress, mode));
|
||||||
_backgroundTranslatorEvent.Set();
|
_backgroundTranslatorEvent.Set();
|
||||||
}
|
}
|
||||||
|
@ -502,6 +511,8 @@ namespace ARMeilleure.Translation
|
||||||
{
|
{
|
||||||
_backgroundTranslatorLock.AcquireWriterLock(Timeout.Infinite);
|
_backgroundTranslatorLock.AcquireWriterLock(Timeout.Infinite);
|
||||||
|
|
||||||
|
Interlocked.Add(ref _requestRemoved, _backgroundStack.Count);
|
||||||
|
|
||||||
if (allowRequeue)
|
if (allowRequeue)
|
||||||
{
|
{
|
||||||
while (_backgroundStack.TryPop(out var request))
|
while (_backgroundStack.TryPop(out var request))
|
||||||
|
|
Loading…
Reference in a new issue