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