PerformanceFrameHeaderVersion1.cs 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. //
  2. // Copyright (c) 2019-2020 Ryujinx
  3. //
  4. // This program is free software: you can redistribute it and/or modify
  5. // it under the terms of the GNU Lesser General Public License as published by
  6. // the Free Software Foundation, either version 3 of the License, or
  7. // (at your option) any later version.
  8. //
  9. // This program is distributed in the hope that it will be useful,
  10. // but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. // GNU Lesser General Public License for more details.
  13. //
  14. // You should have received a copy of the GNU Lesser General Public License
  15. // along with this program. If not, see <https://www.gnu.org/licenses/>.
  16. //
  17. using System.Runtime.InteropServices;
  18. namespace Ryujinx.Audio.Renderer.Server.Performance
  19. {
  20. /// <summary>
  21. /// Implementation of <see cref="IPerformanceHeader"/> for performance metrics version 1.
  22. /// </summary>
  23. [StructLayout(LayoutKind.Sequential, Pack = 1, Size = 0x18)]
  24. public struct PerformanceFrameHeaderVersion1 : IPerformanceHeader
  25. {
  26. /// <summary>
  27. /// The magic of the performance header.
  28. /// </summary>
  29. public uint Magic;
  30. /// <summary>
  31. /// The total count of entries in this frame.
  32. /// </summary>
  33. public int EntryCount;
  34. /// <summary>
  35. /// The total count of detailed entries in this frame.
  36. /// </summary>
  37. public int EntryDetailCount;
  38. /// <summary>
  39. /// The offset of the next performance header.
  40. /// </summary>
  41. public int NextOffset;
  42. /// <summary>
  43. /// The total time taken by all the commands profiled.
  44. /// </summary>
  45. public int TotalProcessingTime;
  46. /// <summary>
  47. /// The count of voices that were dropped.
  48. /// </summary>
  49. public uint VoiceDropCount;
  50. public int GetEntryCount()
  51. {
  52. return EntryCount;
  53. }
  54. public int GetEntryCountOffset()
  55. {
  56. return 4;
  57. }
  58. public int GetEntryDetailCount()
  59. {
  60. return EntryDetailCount;
  61. }
  62. public void SetDspRunningBehind(bool isRunningBehind)
  63. {
  64. // NOTE: Not present in version 1
  65. }
  66. public void SetEntryCount(int entryCount)
  67. {
  68. EntryCount = entryCount;
  69. }
  70. public void SetEntryDetailCount(int entryDetailCount)
  71. {
  72. EntryDetailCount = entryDetailCount;
  73. }
  74. public void SetIndex(uint index)
  75. {
  76. // NOTE: Not present in version 1
  77. }
  78. public void SetMagic(uint magic)
  79. {
  80. Magic = magic;
  81. }
  82. public void SetNextOffset(int nextOffset)
  83. {
  84. NextOffset = nextOffset;
  85. }
  86. public void SetStartRenderingTicks(ulong startTicks)
  87. {
  88. // NOTE: not present in version 1
  89. }
  90. public void SetTotalProcessingTime(int totalProcessingTime)
  91. {
  92. TotalProcessingTime = totalProcessingTime;
  93. }
  94. public void SetVoiceDropCount(uint voiceCount)
  95. {
  96. VoiceDropCount = voiceCount;
  97. }
  98. }
  99. }