-
Notifications
You must be signed in to change notification settings - Fork 2
/
verify_performance.groovy
38 lines (34 loc) · 1.38 KB
/
verify_performance.groovy
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import java.nio.file.Files
// CSV field names
// sampler_label,aggregate_report_count,average,aggregate_report_median,aggregate_report_90%_line,
// aggregate_report_min,aggregate_report_max,aggregate_report_error%,aggregate_report_rate,
// aggregate_report_bandwidth,aggregate_report_stddev
def failed = false;
new File("Aggregate_Report.csv").splitEachLine(",") { fields ->
try {
def label = fields[0];
//def sampleCount = fields[1];
//def average = fields[2];
// Ignore header, footer row if present
if (label != "sampler_label" && label != "TOTAL") {
if (!label.contains('[') || !label.contains(']')) {
throw new NumberFormatException("No acceptable [num] parameter given in "+label);
}
def ninety = fields[4].toInteger();
def acceptable = label.substring(label.indexOf('[')+1, label.indexOf(']')).toInteger();
if (ninety > acceptable) {
println(label + ": 90% line " + ninety + " is greater than acceptable ('" + acceptable + "')");
failed = true;
} else {
println(label + ": OK ("+ninety+"ms)");
}
}
} catch (NumberFormatException nfe) {
println("Error: "+nfe.message);
System.exit(1);
}
}
if (failed) {
println("Verification completed, with errors");
System.exit(1);
}