PerformanceFrameHeaderVersion2.cs 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117
  1. using System.Runtime.InteropServices;
  2. namespace Ryujinx.Audio.Renderer.Server.Performance
  3. {
  4. /// <summary>
  5. /// Implementation of <see cref="IPerformanceHeader"/> for performance metrics version 2.
  6. /// </summary>
  7. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x30)]
  8. public struct PerformanceFrameHeaderVersion2 : IPerformanceHeader
  9. {
  10. /// <summary>
  11. /// The magic of the performance header.
  12. /// </summary>
  13. public uint Magic;
  14. /// <summary>
  15. /// The total count of entries in this frame.
  16. /// </summary>
  17. public int EntryCount;
  18. /// <summary>
  19. /// The total count of detailed entries in this frame.
  20. /// </summary>
  21. public int EntryDetailCount;
  22. /// <summary>
  23. /// The offset of the next performance header.
  24. /// </summary>
  25. public int NextOffset;
  26. /// <summary>
  27. /// The total time taken by all the commands profiled.
  28. /// </summary>
  29. public int TotalProcessingTime;
  30. /// <summary>
  31. /// The count of voices that were dropped.
  32. /// </summary>
  33. public uint VoiceDropCount;
  34. /// <summary>
  35. /// The start ticks of the <see cref="Dsp.AudioProcessor"/>. (before sending commands)
  36. /// </summary>
  37. public ulong StartRenderingTicks;
  38. /// <summary>
  39. /// The index of this performance frame.
  40. /// </summary>
  41. public uint Index;
  42. /// <summary>
  43. /// If set to true, the DSP is running behind.
  44. /// </summary>
  45. [MarshalAs(UnmanagedType.I1)]
  46. public bool IsDspRunningBehind;
  47. public int GetEntryCount()
  48. {
  49. return EntryCount;
  50. }
  51. public int GetEntryCountOffset()
  52. {
  53. return 4;
  54. }
  55. public int GetEntryDetailCount()
  56. {
  57. return EntryDetailCount;
  58. }
  59. public void SetDspRunningBehind(bool isRunningBehind)
  60. {
  61. IsDspRunningBehind = isRunningBehind;
  62. }
  63. public void SetEntryCount(int entryCount)
  64. {
  65. EntryCount = entryCount;
  66. }
  67. public void SetEntryDetailCount(int entryDetailCount)
  68. {
  69. EntryDetailCount = entryDetailCount;
  70. }
  71. public void SetIndex(uint index)
  72. {
  73. Index = index;
  74. }
  75. public void SetMagic(uint magic)
  76. {
  77. Magic = magic;
  78. }
  79. public void SetNextOffset(int nextOffset)
  80. {
  81. NextOffset = nextOffset;
  82. }
  83. public void SetStartRenderingTicks(ulong startTicks)
  84. {
  85. StartRenderingTicks = startTicks;
  86. }
  87. public void SetTotalProcessingTime(int totalProcessingTime)
  88. {
  89. TotalProcessingTime = totalProcessingTime;
  90. }
  91. public void SetVoiceDropCount(uint voiceCount)
  92. {
  93. VoiceDropCount = voiceCount;
  94. }
  95. }
  96. }