PerformanceCommand.cs 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647
  1. using Ryujinx.Audio.Renderer.Server.Performance;
  2. namespace Ryujinx.Audio.Renderer.Dsp.Command
  3. {
  4. public class PerformanceCommand : ICommand
  5. {
  6. public enum Type
  7. {
  8. Invalid,
  9. Start,
  10. End
  11. }
  12. public bool Enabled { get; set; }
  13. public int NodeId { get; }
  14. public CommandType CommandType => CommandType.Performance;
  15. public uint EstimatedProcessingTime { get; set; }
  16. public PerformanceEntryAddresses PerformanceEntryAddresses { get; }
  17. public Type PerformanceType { get; set; }
  18. public PerformanceCommand(ref PerformanceEntryAddresses performanceEntryAddresses, Type performanceType, int nodeId)
  19. {
  20. Enabled = true;
  21. PerformanceEntryAddresses = performanceEntryAddresses;
  22. PerformanceType = performanceType;
  23. NodeId = nodeId;
  24. }
  25. public void Process(CommandList context)
  26. {
  27. if (PerformanceType == Type.Start)
  28. {
  29. PerformanceEntryAddresses.SetStartTime(context.GetTimeElapsedSinceDspStartedProcessing());
  30. }
  31. else if (PerformanceType == Type.End)
  32. {
  33. PerformanceEntryAddresses.SetProcessingTime(context.GetTimeElapsedSinceDspStartedProcessing());
  34. PerformanceEntryAddresses.IncrementEntryCount();
  35. }
  36. }
  37. }
  38. }