2020-08-17 18:49:37 -07:00
|
|
|
using Ryujinx.Audio.Renderer.Server.Performance;
|
|
|
|
|
|
|
|
namespace Ryujinx.Audio.Renderer.Dsp.Command
|
|
|
|
{
|
|
|
|
public class PerformanceCommand : ICommand
|
|
|
|
{
|
|
|
|
public enum Type
|
|
|
|
{
|
|
|
|
Invalid,
|
|
|
|
Start,
|
|
|
|
End
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool Enabled { get; set; }
|
|
|
|
|
|
|
|
public int NodeId { get; }
|
|
|
|
|
|
|
|
public CommandType CommandType => CommandType.Performance;
|
|
|
|
|
2022-11-27 23:28:45 -08:00
|
|
|
public uint EstimatedProcessingTime { get; set; }
|
2020-08-17 18:49:37 -07:00
|
|
|
|
|
|
|
public PerformanceEntryAddresses PerformanceEntryAddresses { get; }
|
|
|
|
|
|
|
|
public Type PerformanceType { get; set; }
|
|
|
|
|
|
|
|
public PerformanceCommand(ref PerformanceEntryAddresses performanceEntryAddresses, Type performanceType, int nodeId)
|
|
|
|
{
|
|
|
|
Enabled = true;
|
|
|
|
PerformanceEntryAddresses = performanceEntryAddresses;
|
|
|
|
PerformanceType = performanceType;
|
|
|
|
NodeId = nodeId;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void Process(CommandList context)
|
|
|
|
{
|
|
|
|
if (PerformanceType == Type.Start)
|
|
|
|
{
|
|
|
|
PerformanceEntryAddresses.SetStartTime(context.GetTimeElapsedSinceDspStartedProcessing());
|
|
|
|
}
|
|
|
|
else if (PerformanceType == Type.End)
|
|
|
|
{
|
|
|
|
PerformanceEntryAddresses.SetProcessingTime(context.GetTimeElapsedSinceDspStartedProcessing());
|
|
|
|
PerformanceEntryAddresses.IncrementEntryCount();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2022-07-25 11:46:33 -07:00
|
|
|
}
|