@@ -19,8 +19,9 @@ public struct Measurement : IComparable<Measurement>
19
19
20
20
private const string NsSymbol = "ns" ;
21
21
private const string OpSymbol = "op" ;
22
+ private const string SBSymbol = "B" ;
22
23
23
- private static Measurement Error ( ) => new Measurement ( - 1 , IterationMode . Unknown , IterationStage . Unknown , 0 , 0 , 0 ) ;
24
+ private static Measurement Error ( ) => new Measurement ( - 1 , IterationMode . Unknown , IterationStage . Unknown , 0 , 0 , 0 , 0 ) ;
24
25
25
26
private static readonly int IterationInfoNameMaxWidth
26
27
= Enum . GetNames ( typeof ( IterationMode ) ) . Max ( text => text . Length ) + Enum . GetNames ( typeof ( IterationStage ) ) . Max ( text => text . Length ) ;
@@ -43,6 +44,11 @@ private static readonly int IterationInfoNameMaxWidth
43
44
/// </summary>
44
45
public double Nanoseconds { get ; }
45
46
47
+ /// <summary>
48
+ /// Gets the total number of survived bytes from all operations.
49
+ /// </summary>
50
+ public long SurvivedBytes { get ; }
51
+
46
52
/// <summary>
47
53
/// Creates an instance of <see cref="Measurement"/> struct.
48
54
/// </summary>
@@ -52,14 +58,16 @@ private static readonly int IterationInfoNameMaxWidth
52
58
/// <param name="iterationIndex"></param>
53
59
/// <param name="operations">The number of operations performed.</param>
54
60
/// <param name="nanoseconds">The total number of nanoseconds it took to perform all operations.</param>
55
- public Measurement ( int launchIndex , IterationMode iterationMode , IterationStage iterationStage , int iterationIndex , long operations , double nanoseconds )
61
+ /// <param name="survivedBytes">The total number of survived bytes from all operations.</param>
62
+ public Measurement ( int launchIndex , IterationMode iterationMode , IterationStage iterationStage , int iterationIndex , long operations , double nanoseconds , long survivedBytes )
56
63
{
57
64
Operations = operations ;
58
65
Nanoseconds = nanoseconds ;
59
66
LaunchIndex = launchIndex ;
60
67
IterationMode = iterationMode ;
61
68
IterationStage = iterationStage ;
62
69
IterationIndex = iterationIndex ;
70
+ SurvivedBytes = survivedBytes ;
63
71
}
64
72
65
73
private static IterationMode ParseIterationMode ( string name ) => Enum . TryParse ( name , out IterationMode mode ) ? mode : IterationMode . Unknown ;
@@ -98,6 +106,15 @@ public override string ToString()
98
106
builder . Append ( GetAverageTime ( ) . ToString ( MainCultureInfo ) . ToAscii ( ) ) ;
99
107
builder . Append ( "/op" ) ;
100
108
109
+ if ( SurvivedBytes != 0 )
110
+ {
111
+ builder . Append ( ", " ) ;
112
+ builder . Append ( SurvivedBytes . ToString ( MainCultureInfo ) ) ;
113
+ builder . Append ( ' ' ) ;
114
+ builder . Append ( SBSymbol ) ;
115
+ builder . Append ( " Survived" ) ;
116
+ }
117
+
101
118
return builder . ToString ( ) ;
102
119
}
103
120
@@ -146,6 +163,7 @@ public static Measurement Parse(ILogger logger, string line, int processIndex)
146
163
var measurementsInfoSplit = measurementsInfo . Split ( new [ ] { ',' } , StringSplitOptions . RemoveEmptyEntries ) ;
147
164
long op = 1L ;
148
165
double ns = double . PositiveInfinity ;
166
+ long survived = 0 ;
149
167
foreach ( string item in measurementsInfoSplit )
150
168
{
151
169
var measurementSplit = item . Split ( new [ ] { ' ' } , StringSplitOptions . RemoveEmptyEntries ) ;
@@ -159,9 +177,12 @@ public static Measurement Parse(ILogger logger, string line, int processIndex)
159
177
case OpSymbol :
160
178
op = long . Parse ( value , MainCultureInfo ) ;
161
179
break ;
180
+ case SBSymbol :
181
+ survived = long . Parse ( value , MainCultureInfo ) ;
182
+ break ;
162
183
}
163
184
}
164
- return new Measurement ( processIndex , iterationMode , iterationStage , iterationIndex , op , ns ) ;
185
+ return new Measurement ( processIndex , iterationMode , iterationStage , iterationIndex , op , ns , survived ) ;
165
186
}
166
187
catch ( Exception )
167
188
{
0 commit comments