Nav apraksta
Nevar pievienot vairāk kā 25 tēmas Tēmai ir jāsākas ar burtu vai ciparu, tā var saturēt domu zīmes ('-') un var būt līdz 35 simboliem gara.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100
  1. using System;
  2. ////TODO: provide total metric for amount of unmanaged memory (device state + action state)
  3. ////REVIEW: flag to turn it off? disable when analytics is off?
  4. namespace UnityEngine.InputSystem.LowLevel
  5. {
  6. /// <summary>
  7. /// Provides information on the level of throughput going through the system.
  8. /// </summary>
  9. /// <seealso cref="InputSystem.metrics"/>
  10. [Serializable]
  11. public struct InputMetrics
  12. {
  13. /// <summary>
  14. /// Maximum number of devices that were concurrently added to the system.
  15. /// </summary>
  16. /// <seealso cref="InputSystem.devices"/>
  17. public int maxNumDevices { get; set; }
  18. /// <summary>
  19. /// Number of devices currently added to the system.
  20. /// </summary>
  21. /// <seealso cref="InputSystem.devices"/>
  22. public int currentNumDevices { get; set; }
  23. /// <summary>
  24. /// The largest the combined state memory for all devices got.
  25. /// </summary>
  26. public int maxStateSizeInBytes { get; set; }
  27. /// <summary>
  28. /// Total size of the combined state memory for all current devices.
  29. /// </summary>
  30. public int currentStateSizeInBytes { get; set; }
  31. /// <summary>
  32. /// Total number of <see cref="InputControl"/>s currently alive in
  33. /// devices in the system.
  34. /// </summary>
  35. public int currentControlCount { get; set; }
  36. /// <summary>
  37. /// Total number of currently registered layouts.
  38. /// </summary>
  39. public int currentLayoutCount { get; set; }
  40. /// <summary>
  41. /// Total number of bytes of <see cref="InputEvent"/>s consumed so far.
  42. /// </summary>
  43. public int totalEventBytes { get; set; }
  44. /// <summary>
  45. /// Total number of <see cref="InputEvent"/>s consumed so far.
  46. /// </summary>
  47. public int totalEventCount { get; set; }
  48. /// <summary>
  49. /// Total number of input system updates run so far.
  50. /// </summary>
  51. /// <seealso cref="InputSystem.Update"/>
  52. public int totalUpdateCount { get; set; }
  53. /// <summary>
  54. /// Total time in seconds spent processing <see cref="InputEvent"/>s so far.
  55. /// </summary>
  56. /// <remarks>
  57. /// Event processing usually amounts for the majority of time spent in <see cref="InputSystem.Update"/>
  58. /// but not necessarily for all of it.
  59. /// </remarks>
  60. /// <seealso cref="InputSystem.Update"/>
  61. public double totalEventProcessingTime { get; set; }
  62. /// <summary>
  63. /// Total accumulated time that has passed between when events were generated (see <see cref="InputEvent.time"/>)
  64. /// compared to when they were processed.
  65. /// </summary>
  66. public double totalEventLagTime { get; set; }
  67. /// <summary>
  68. /// Average size of the event buffer received on every <see cref="InputSystem.Update"/>.
  69. /// </summary>
  70. public float averageEventBytesPerFrame => (float)totalEventBytes / totalUpdateCount;
  71. ////REVIEW: we probably want better averaging than we get with this method; ideally, we should take averages
  72. //// each frame and then compute weighted averages as we go; the current method disregards updating spacing
  73. //// and event clustering entirely
  74. /// <summary>
  75. /// Average time in seconds spend on processing each individual <see cref="InputEvent"/>.
  76. /// </summary>
  77. public double averageProcessingTimePerEvent => totalEventProcessingTime / totalEventCount;
  78. /// <summary>
  79. /// Average time it takes from when an event is generated to when it is processed.
  80. /// </summary>
  81. /// <seealso cref="totalEventLagTime"/>
  82. public double averageLagTimePerEvent => totalEventLagTime / totalEventCount;
  83. }
  84. }