PerformanceEntryAddresses.cs 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. using System;
  2. namespace Ryujinx.Audio.Renderer.Server.Performance
  3. {
  4. /// <summary>
  5. /// Information used by the performance command to store informations in the performance entry.
  6. /// </summary>
  7. public class PerformanceEntryAddresses
  8. {
  9. /// <summary>
  10. /// The memory storing the performance entry.
  11. /// </summary>
  12. public Memory<int> BaseMemory;
  13. /// <summary>
  14. /// The offset to the start time field.
  15. /// </summary>
  16. public uint StartTimeOffset;
  17. /// <summary>
  18. /// The offset to the entry count field.
  19. /// </summary>
  20. public uint EntryCountOffset;
  21. /// <summary>
  22. /// The offset to the processing time field.
  23. /// </summary>
  24. public uint ProcessingTimeOffset;
  25. /// <summary>
  26. /// Increment the entry count.
  27. /// </summary>
  28. public void IncrementEntryCount()
  29. {
  30. BaseMemory.Span[(int)EntryCountOffset / 4]++;
  31. }
  32. /// <summary>
  33. /// Set the start time in the entry.
  34. /// </summary>
  35. /// <param name="startTimeNano">The start time in nanoseconds.</param>
  36. public void SetStartTime(ulong startTimeNano)
  37. {
  38. BaseMemory.Span[(int)StartTimeOffset / 4] = (int)(startTimeNano / 1000);
  39. }
  40. /// <summary>
  41. /// Set the processing time in the entry.
  42. /// </summary>
  43. /// <param name="endTimeNano">The end time in nanoseconds.</param>
  44. public void SetProcessingTime(ulong endTimeNano)
  45. {
  46. BaseMemory.Span[(int)ProcessingTimeOffset / 4] = (int)(endTimeNano / 1000) - BaseMemory.Span[(int)StartTimeOffset / 4];
  47. }
  48. }
  49. }