1
- using System . Collections . Generic ;
1
+ using System ;
2
+ using System . Collections . Generic ;
3
+ using System . ComponentModel ;
2
4
using MLAPI . Collections ;
3
5
using MLAPI . Configuration ;
4
6
using UnityEngine ;
@@ -17,7 +19,14 @@ public static class NetworkProfiler
17
19
/// <summary>
18
20
/// Whether or not the profiler is recording data
19
21
/// </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
+
21
30
private static int tickHistory = 1024 ;
22
31
private static int EventIdCounter = 0 ;
23
32
private static ProfilerTick CurrentTick ;
@@ -28,13 +37,13 @@ public static class NetworkProfiler
28
37
/// <param name="historyLength">The amount of ticks to keep in memory</param>
29
38
public static void Start ( int historyLength )
30
39
{
31
- if ( isRunning )
40
+ if ( IsRunning )
32
41
return ;
33
42
EventIdCounter = 0 ;
34
43
Ticks = new FixedQueue < ProfilerTick > ( historyLength ) ;
35
44
tickHistory = historyLength ;
36
45
CurrentTick = null ;
37
- isRunning = true ;
46
+ IsRunning = true ;
38
47
}
39
48
40
49
/// <summary>
@@ -44,7 +53,7 @@ public static void Stop()
44
53
{
45
54
Ticks = null ; //leave to GC
46
55
CurrentTick = null ; //leave to GC
47
- isRunning = false ;
56
+ IsRunning = false ;
48
57
}
49
58
50
59
/// <summary>
@@ -54,14 +63,14 @@ public static void Stop()
54
63
/// <returns>The number of ticks recorded</returns>
55
64
public static int Stop ( ref ProfilerTick [ ] tickBuffer )
56
65
{
57
- if ( ! isRunning )
66
+ if ( ! IsRunning )
58
67
return 0 ;
59
68
int iteration = Ticks . Count > tickBuffer . Length ? tickBuffer . Length : Ticks . Count ;
60
69
for ( int i = 0 ; i < iteration ; i ++ ) tickBuffer [ i ] = Ticks [ i ] ;
61
70
62
71
Ticks = null ; //leave to GC
63
72
CurrentTick = null ; //leave to GC
64
- isRunning = false ;
73
+ IsRunning = false ;
65
74
66
75
return iteration ;
67
76
}
@@ -73,21 +82,21 @@ public static int Stop(ref ProfilerTick[] tickBuffer)
73
82
/// <returns>The number of ticks recorded</returns>
74
83
public static int Stop ( ref List < ProfilerTick > tickBuffer )
75
84
{
76
- if ( ! isRunning )
85
+ if ( ! IsRunning )
77
86
return 0 ;
78
87
int iteration = Ticks . Count > tickBuffer . Count ? tickBuffer . Count : Ticks . Count ;
79
88
for ( int i = 0 ; i < iteration ; i ++ ) tickBuffer [ i ] = Ticks [ i ] ;
80
89
81
90
Ticks = null ; //leave to GC
82
91
CurrentTick = null ; //leave to GC
83
- isRunning = false ;
92
+ IsRunning = false ;
84
93
85
94
return iteration ;
86
95
}
87
96
88
97
internal static void StartTick ( TickType type )
89
98
{
90
- if ( ! isRunning )
99
+ if ( ! IsRunning )
91
100
return ;
92
101
if ( Ticks . Count == tickHistory )
93
102
Ticks . Dequeue ( ) ;
@@ -105,7 +114,7 @@ internal static void StartTick(TickType type)
105
114
106
115
internal static void EndTick ( )
107
116
{
108
- if ( ! isRunning )
117
+ if ( ! IsRunning )
109
118
return ;
110
119
if ( CurrentTick == null )
111
120
return ;
@@ -114,7 +123,7 @@ internal static void EndTick()
114
123
115
124
internal static void StartEvent ( TickType eventType , uint bytes , string channelName , byte messageType )
116
125
{
117
- if ( ! isRunning )
126
+ if ( ! IsRunning )
118
127
return ;
119
128
if ( CurrentTick == null )
120
129
return ;
@@ -126,7 +135,7 @@ internal static void StartEvent(TickType eventType, uint bytes, string channelNa
126
135
127
136
internal static void StartEvent ( TickType eventType , uint bytes , string channelName , string messageName )
128
137
{
129
- if ( ! isRunning )
138
+ if ( ! IsRunning )
130
139
return ;
131
140
if ( CurrentTick == null )
132
141
return ;
@@ -136,7 +145,7 @@ internal static void StartEvent(TickType eventType, uint bytes, string channelNa
136
145
137
146
internal static void EndEvent ( )
138
147
{
139
- if ( ! isRunning )
148
+ if ( ! IsRunning )
140
149
return ;
141
150
if ( CurrentTick == null )
142
151
return ;
0 commit comments