1- using System . Collections . Generic ;
1+ using System ;
2+ using System . Collections . Generic ;
3+ using System . ComponentModel ;
24using MLAPI . Collections ;
35using MLAPI . Configuration ;
46using UnityEngine ;
@@ -17,7 +19,14 @@ public static class NetworkProfiler
1719 /// <summary>
1820 /// Whether or not the profiler is recording data
1921 /// </summary>
20- public static bool isRunning { get ; private set ; }
22+ [ EditorBrowsable ( EditorBrowsableState . Never ) ]
23+ [ Obsolete ( "Use IsRunning instead" , false ) ]
24+ public static bool isRunning => IsRunning ;
25+ /// <summary>
26+ /// Whether or not the profiler is recording data
27+ /// </summary>
28+ public static bool IsRunning { get ; private set ; }
29+
2130 private static int tickHistory = 1024 ;
2231 private static int EventIdCounter = 0 ;
2332 private static ProfilerTick CurrentTick ;
@@ -28,13 +37,13 @@ public static class NetworkProfiler
2837 /// <param name="historyLength">The amount of ticks to keep in memory</param>
2938 public static void Start ( int historyLength )
3039 {
31- if ( isRunning )
40+ if ( IsRunning )
3241 return ;
3342 EventIdCounter = 0 ;
3443 Ticks = new FixedQueue < ProfilerTick > ( historyLength ) ;
3544 tickHistory = historyLength ;
3645 CurrentTick = null ;
37- isRunning = true ;
46+ IsRunning = true ;
3847 }
3948
4049 /// <summary>
@@ -44,7 +53,7 @@ public static void Stop()
4453 {
4554 Ticks = null ; //leave to GC
4655 CurrentTick = null ; //leave to GC
47- isRunning = false ;
56+ IsRunning = false ;
4857 }
4958
5059 /// <summary>
@@ -54,14 +63,14 @@ public static void Stop()
5463 /// <returns>The number of ticks recorded</returns>
5564 public static int Stop ( ref ProfilerTick [ ] tickBuffer )
5665 {
57- if ( ! isRunning )
66+ if ( ! IsRunning )
5867 return 0 ;
5968 int iteration = Ticks . Count > tickBuffer . Length ? tickBuffer . Length : Ticks . Count ;
6069 for ( int i = 0 ; i < iteration ; i ++ ) tickBuffer [ i ] = Ticks [ i ] ;
6170
6271 Ticks = null ; //leave to GC
6372 CurrentTick = null ; //leave to GC
64- isRunning = false ;
73+ IsRunning = false ;
6574
6675 return iteration ;
6776 }
@@ -73,21 +82,21 @@ public static int Stop(ref ProfilerTick[] tickBuffer)
7382 /// <returns>The number of ticks recorded</returns>
7483 public static int Stop ( ref List < ProfilerTick > tickBuffer )
7584 {
76- if ( ! isRunning )
85+ if ( ! IsRunning )
7786 return 0 ;
7887 int iteration = Ticks . Count > tickBuffer . Count ? tickBuffer . Count : Ticks . Count ;
7988 for ( int i = 0 ; i < iteration ; i ++ ) tickBuffer [ i ] = Ticks [ i ] ;
8089
8190 Ticks = null ; //leave to GC
8291 CurrentTick = null ; //leave to GC
83- isRunning = false ;
92+ IsRunning = false ;
8493
8594 return iteration ;
8695 }
8796
8897 internal static void StartTick ( TickType type )
8998 {
90- if ( ! isRunning )
99+ if ( ! IsRunning )
91100 return ;
92101 if ( Ticks . Count == tickHistory )
93102 Ticks . Dequeue ( ) ;
@@ -105,7 +114,7 @@ internal static void StartTick(TickType type)
105114
106115 internal static void EndTick ( )
107116 {
108- if ( ! isRunning )
117+ if ( ! IsRunning )
109118 return ;
110119 if ( CurrentTick == null )
111120 return ;
@@ -114,7 +123,7 @@ internal static void EndTick()
114123
115124 internal static void StartEvent ( TickType eventType , uint bytes , string channelName , byte messageType )
116125 {
117- if ( ! isRunning )
126+ if ( ! IsRunning )
118127 return ;
119128 if ( CurrentTick == null )
120129 return ;
@@ -126,7 +135,7 @@ internal static void StartEvent(TickType eventType, uint bytes, string channelNa
126135
127136 internal static void StartEvent ( TickType eventType , uint bytes , string channelName , string messageName )
128137 {
129- if ( ! isRunning )
138+ if ( ! IsRunning )
130139 return ;
131140 if ( CurrentTick == null )
132141 return ;
@@ -136,7 +145,7 @@ internal static void StartEvent(TickType eventType, uint bytes, string channelNa
136145
137146 internal static void EndEvent ( )
138147 {
139- if ( ! isRunning )
148+ if ( ! IsRunning )
140149 return ;
141150 if ( CurrentTick == null )
142151 return ;
0 commit comments