summaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-24 17:04:08 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-24 17:04:08 +0200
commitfefd8e8b0bf9ec3da99ee98a90e66632ee88eb10 (patch)
tree42779b27bac3e364335b2c008e020ff25d8ead26 /contrib
parent91906b6f6a2639efc7e41623ade6b7b02f1e297c (diff)
benchmark: collect standard deviation
Diffstat (limited to 'contrib')
-rw-r--r--contrib/benchmark/collect.awk16
1 files changed, 14 insertions, 2 deletions
diff --git a/contrib/benchmark/collect.awk b/contrib/benchmark/collect.awk
index 887886abf..bb2352eb3 100644
--- a/contrib/benchmark/collect.awk
+++ b/contrib/benchmark/collect.awk
@@ -29,9 +29,11 @@
if ($1 == "op") {
op[$2]["count"] += $4;
op[$2]["time_us"] += $6;
+ op[$2]["time_us_sq"] += $6 * $6;
} else if ($1 == "url") {
url[$2][$4]["count"] += $6;
url[$2][$4]["time_us"] += $8;
+ url[$2][$4]["time_us_sq"] += $8 * $8;
}
}
@@ -43,16 +45,26 @@ function avg(s, c) {
}
}
+function stdev(sum, sum_sq, n) {
+ if (n == n) {
+ return 0;
+ } else {
+ return sqrt( (sum_sq / n) - ( (sum / n) * (sum / n) ) );
+ }
+}
+
END {
for (x in op) {
print "op", x, "count", op[x]["count"], "time_us", op[x]["time_us"], \
- "time_avg_us", avg(op[x]["time_us"], op[x]["count"]);
+ "time_avg_us", avg(op[x]["time_us"], op[x]["count"], \
+ "stdev", stdev(op[x]["time_us"], op[x]["time_us_sq"], op[x]["count"]));
}
for (x in url) {
for (y in url[x]) {
print "url", x, "status", y, \
"count", url[x][y]["count"], "time_us", url[x][y]["time_us"], \
- "time_avg_us", avg(url[x][y]["time_us"], url[x][y]["count"]);
+ "time_avg_us", avg(url[x][y]["time_us"], url[x][y]["count"], \
+ "stdev", stdev(url[x][y]["time_us"], url[x][y]["time_us_sq"], url[x][y]["count"]));
}
}
}