@@ -10,70 +10,84 @@ namespace UnityEngine.InputSystem.Editor
1010 /// <summary>
1111 /// A profiler module that integrates Input System with the Profiler editor window.
1212 /// </summary>
13- [ ProfilerModuleMetadata ( "Input System" ) ]
13+ [ ProfilerModuleMetadata ( "Input System" ) ]
1414 internal sealed class InputSystemProfilerModule : ProfilerModule
1515 {
1616 /// <summary>
1717 /// A profiler module detail view that extends the Profiler window and shows details for the selected frame.
1818 /// </summary>
1919 private sealed class InputSystemDetailsViewController : ProfilerModuleViewController
20- {
21- public InputSystemDetailsViewController ( ProfilerWindow profilerWindow )
22- : base ( profilerWindow )
23- { }
20+ {
21+ public InputSystemDetailsViewController ( ProfilerWindow profilerWindow )
22+ : base ( profilerWindow )
23+ { }
2424
25+ private Label m_UpdateCountLabel ;
2526 private Label m_EventCountLabel ;
2627 private Label m_EventSizeLabel ;
2728 private Label m_AverageLatencyLabel ;
2829 private Label m_MaxLatencyLabel ;
2930 private Label m_EventProcessingTimeLabel ;
31+ private Label m_DeviceCountLabel ;
32+ private Label m_ControlCountLabel ;
33+ private Label m_StateBufferSizeLabel ;
3034
3135 private Label CreateLabel ( )
3236 {
3337 return new Label ( ) { style = { paddingTop = 8 , paddingLeft = 8 } } ;
3438 }
35-
39+
3640 protected override VisualElement CreateView ( )
3741 {
3842 var view = new VisualElement ( ) ;
3943
44+ m_UpdateCountLabel = CreateLabel ( ) ;
4045 m_EventCountLabel = CreateLabel ( ) ;
4146 m_EventSizeLabel = CreateLabel ( ) ;
4247 m_AverageLatencyLabel = CreateLabel ( ) ;
4348 m_MaxLatencyLabel = CreateLabel ( ) ;
4449 m_EventProcessingTimeLabel = CreateLabel ( ) ;
45-
50+ m_DeviceCountLabel = CreateLabel ( ) ;
51+ m_ControlCountLabel = CreateLabel ( ) ;
52+ m_StateBufferSizeLabel = CreateLabel ( ) ;
53+
54+ view . Add ( m_UpdateCountLabel ) ;
4655 view . Add ( m_EventCountLabel ) ;
4756 view . Add ( m_EventSizeLabel ) ;
4857 view . Add ( m_AverageLatencyLabel ) ;
4958 view . Add ( m_MaxLatencyLabel ) ;
5059 view . Add ( m_EventProcessingTimeLabel ) ;
60+ view . Add ( m_DeviceCountLabel ) ;
61+ view . Add ( m_ControlCountLabel ) ;
62+ view . Add ( m_StateBufferSizeLabel ) ;
5163
52- // Populate the label with the current data for the selected frame.
64+ // Populate the label with the current data for the selected frame.
5365 ReloadData ( ) ;
5466
5567 // Be notified when the selected frame index in the Profiler Window changes, so we can update the label.
5668 ProfilerWindow . SelectedFrameIndexChanged += OnSelectedFrameIndexChanged ;
5769
5870 return view ;
5971 }
60-
72+
6173 protected override void Dispose ( bool disposing )
6274 {
6375 if ( disposing )
6476 {
6577 // Unsubscribe from the Profiler window event that we previously subscribed to.
6678 ProfilerWindow . SelectedFrameIndexChanged -= OnSelectedFrameIndexChanged ;
6779 }
68-
80+
6981 base . Dispose ( disposing ) ;
7082 }
7183
7284 void ReloadData ( )
7385 {
7486 var selectedFrameIndex = System . Convert . ToInt32 ( ProfilerWindow . selectedFrameIndex ) ;
75-
76- var eventCount = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
87+
88+ var updateCount = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
89+ InputStatistics . Category . Name , InputStatistics . UpdateCountName ) ;
90+ var eventCount = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
7791 InputStatistics . Category . Name , InputStatistics . EventCountName ) ;
7892 var eventSizeBytes = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
7993 InputStatistics . Category . Name , InputStatistics . EventSizeName ) ;
@@ -83,38 +97,52 @@ void ReloadData()
8397 InputStatistics . Category . Name , InputStatistics . MaxLatencyName ) ;
8498 var eventProcessingTime = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
8599 InputStatistics . Category . Name , InputStatistics . EventProcessingTimeName ) ;
100+ var stateBufferSizeBytes = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
101+ InputStatistics . Category . Name , InputStatistics . StateBufferSizeBytesName ) ;
102+ var deviceCount = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
103+ InputStatistics . Category . Name , InputStatistics . DeviceCountName ) ;
104+ var controlCount = ProfilerDriver . GetFormattedCounterValue ( selectedFrameIndex ,
105+ InputStatistics . Category . Name , InputStatistics . ControlCountName ) ;
86106
107+ m_UpdateCountLabel . text = $ "{ InputStatistics . UpdateCountName } : { updateCount } ";
87108 m_EventCountLabel . text = $ "{ InputStatistics . EventCountName } : { eventCount } ";
88109 m_EventSizeLabel . text = $ "{ InputStatistics . EventSizeName } : { eventSizeBytes } ";
89110 m_AverageLatencyLabel . text = $ "{ InputStatistics . AverageLatencyName } : { averageLatency } ";
90111 m_MaxLatencyLabel . text = $ "{ InputStatistics . MaxLatencyName } : { maxLatency } ";
91112 m_EventProcessingTimeLabel . text = $ "{ InputStatistics . EventProcessingTimeName } : { eventProcessingTime } ";
113+ m_StateBufferSizeLabel . text = $ "{ InputStatistics . StateBufferSizeBytesName } : { stateBufferSizeBytes } ";
114+ m_DeviceCountLabel . text = $ "{ InputStatistics . DeviceCountName } : { deviceCount } ";
115+ m_ControlCountLabel . text = $ "{ InputStatistics . ControlCountName } : { controlCount } ";
92116 }
93-
117+
94118 void OnSelectedFrameIndexChanged ( long selectedFrameIndex )
95119 {
96120 ReloadData ( ) ;
97121 }
98122 }
99-
123+
100124 private static readonly ProfilerCounterDescriptor [ ] Counters = new ProfilerCounterDescriptor [ ]
101125 {
102- new ( InputStatistics . EventCountName , InputStatistics . Category ) ,
103- new ( InputStatistics . EventSizeName , InputStatistics . Category ) ,
104- new ( InputStatistics . AverageLatencyName , InputStatistics . Category ) ,
105- new ( InputStatistics . MaxLatencyName , InputStatistics . Category ) ,
106- new ( InputStatistics . EventProcessingTimeName , InputStatistics . Category ) ,
126+ new ( InputStatistics . UpdateCountName , InputStatistics . Category ) ,
127+ new ( InputStatistics . EventCountName , InputStatistics . Category ) ,
128+ new ( InputStatistics . EventSizeName , InputStatistics . Category ) ,
129+ new ( InputStatistics . StateBufferSizeBytesName , InputStatistics . Category ) ,
130+ new ( InputStatistics . AverageLatencyName , InputStatistics . Category ) ,
131+ new ( InputStatistics . MaxLatencyName , InputStatistics . Category ) ,
132+ new ( InputStatistics . EventProcessingTimeName , InputStatistics . Category ) ,
133+ new ( InputStatistics . DeviceCountName , InputStatistics . Category ) ,
134+ new ( InputStatistics . ControlCountName , InputStatistics . Category ) ,
107135 } ;
108-
136+
109137 public InputSystemProfilerModule ( )
110138 : base ( Counters )
111- { }
112-
139+ { }
140+
113141 public override ProfilerModuleViewController CreateDetailsViewController ( )
114142 {
115143 return new InputSystemDetailsViewController ( ProfilerWindow ) ;
116144 }
117145 }
118146}
119147
120- #endif // UNITY_EDITOR
148+ #endif // UNITY_EDITOR
0 commit comments