@@ -44,6 +44,7 @@ type Doc struct {
44
44
ClientPodCPU []metrics.PodCPU `json:"clientPods"`
45
45
ClientNodeLabels map [string ]string `json:"clientNodeLabels"`
46
46
ServerNodeLabels map [string ]string `json:"serverNodeLabels"`
47
+ Confidence []float64 `json:"confidence"`
47
48
}
48
49
49
50
// Connect returns a client connected to the desired cluster.
@@ -80,6 +81,11 @@ func BuildDocs(sr result.ScenarioResults, uuid string) ([]interface{}, error) {
80
81
if len (r .Driver ) < 1 {
81
82
continue
82
83
}
84
+ var lo , hi float64
85
+ if r .Samples > 1 {
86
+ _ , lo , hi = result .ConfidenceInterval (r .ThroughputSummary , 0.95 )
87
+ }
88
+ c := []float64 {lo , hi }
83
89
d := Doc {
84
90
UUID : uuid ,
85
91
Timestamp : time ,
@@ -101,6 +107,7 @@ func BuildDocs(sr result.ScenarioResults, uuid string) ([]interface{}, error) {
101
107
ServerNodeLabels : r .ServerNodeLabels ,
102
108
ClientNodeLabels : r .ClientNodeLabels ,
103
109
AcrossAZ : r .AcrossAZ ,
110
+ Confidence : c ,
104
111
}
105
112
UDPLossPercent , e := result .Average (r .LossSummary )
106
113
if e != nil {
@@ -147,11 +154,17 @@ func commonCsvHeaderFields() []string {
147
154
"Parallelism" ,
148
155
"# of Samples" ,
149
156
"Message Size" ,
157
+ "Confidence metric - low" ,
158
+ "Confidence metric - high" ,
150
159
}
151
160
}
152
161
153
162
// Common csv data fields.
154
- func commonCsvDataFeilds (row result.Data ) []string {
163
+ func commonCsvDataFields (row result.Data ) []string {
164
+ var lo , hi float64
165
+ if row .Samples > 1 {
166
+ _ , lo , hi = result .ConfidenceInterval (row .ThroughputSummary , 0.95 )
167
+ }
155
168
return []string {
156
169
fmt .Sprint (row .Driver ),
157
170
fmt .Sprint (row .Profile ),
@@ -162,15 +175,17 @@ func commonCsvDataFeilds(row result.Data) []string {
162
175
strconv .Itoa (row .Parallelism ),
163
176
strconv .Itoa (row .Samples ),
164
177
strconv .Itoa (row .MessageSize ),
178
+ strconv .FormatFloat (lo , 'f' , - 1 , 64 ),
179
+ strconv .FormatFloat (hi , 'f' , - 1 , 64 ),
165
180
}
166
181
}
167
182
168
- // Writes all the mertic feilds to the archive.
183
+ // Writes all the mertics to the archive.
169
184
func writeArchive (cpuarchive , podarchive * csv.Writer , role string , row result.Data , podResults []metrics.PodCPU ) error {
170
185
roleFieldData := []string {role }
171
186
for _ , pod := range podResults {
172
187
if err := podarchive .Write (append (append (roleFieldData ,
173
- commonCsvDataFeilds (row )... ),
188
+ commonCsvDataFields (row )... ),
174
189
pod .Name ,
175
190
fmt .Sprintf ("%f" , pod .Value ),
176
191
)); err != nil {
@@ -183,7 +198,7 @@ func writeArchive(cpuarchive, podarchive *csv.Writer, role string, row result.Da
183
198
cpu = row .ServerMetrics
184
199
}
185
200
if err := cpuarchive .Write (append (append (roleFieldData ,
186
- commonCsvDataFeilds (row )... ),
201
+ commonCsvDataFields (row )... ),
187
202
fmt .Sprintf ("%f" , cpu .Idle ),
188
203
fmt .Sprintf ("%f" , cpu .User ),
189
204
fmt .Sprintf ("%f" , cpu .System ),
@@ -265,7 +280,7 @@ func WriteSpecificCSV(r result.ScenarioResults) error {
265
280
if strings .Contains (row .Profile , "UDP_STREAM" ) {
266
281
loss , _ := result .Average (row .LossSummary )
267
282
header := []string {"UDP Percent Loss" }
268
- data := append (header , commonCsvDataFeilds (row )... )
283
+ data := append (header , commonCsvDataFields (row )... )
269
284
iperfdata = append (data , fmt .Sprintf ("%f" , loss ))
270
285
if err := archive .Write (iperfdata ); err != nil {
271
286
return fmt .Errorf ("failed to write result archive to file" )
@@ -274,7 +289,7 @@ func WriteSpecificCSV(r result.ScenarioResults) error {
274
289
if strings .Contains (row .Profile , "TCP_STREAM" ) {
275
290
rt , _ := result .Average (row .RetransmitSummary )
276
291
header := []string {"TCP Retransmissions" }
277
- data := append (header , commonCsvDataFeilds (row )... )
292
+ data := append (header , commonCsvDataFields (row )... )
278
293
iperfdata = append (data , fmt .Sprintf ("%f" , rt ))
279
294
if err := archive .Write (iperfdata ); err != nil {
280
295
return fmt .Errorf ("failed to write result archive to file" )
@@ -322,7 +337,7 @@ func WriteCSVResult(r result.ScenarioResults) error {
322
337
for _ , row := range r .Results {
323
338
avg , _ := result .Average (row .ThroughputSummary )
324
339
lavg , _ := result .Average (row .LatencySummary )
325
- data := append (commonCsvDataFeilds (row ),
340
+ data := append (commonCsvDataFields (row ),
326
341
fmt .Sprintf ("%f" , avg ),
327
342
row .Metric ,
328
343
fmt .Sprint (lavg ),
0 commit comments