summaryrefslogtreecommitdiff
path: root/contrib/benchmark
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-24 19:28:28 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-24 19:28:28 +0200
commit58a12be5d2843d76c185d93c690a8e6d835824fc (patch)
tree45ae59b31a28ebf0840377a5868025b6a47dd032 /contrib/benchmark
parent44276a810cd08acb9910a96c3d08e635a28103e2 (diff)
benchmark: fix stdev
Diffstat (limited to 'contrib/benchmark')
-rw-r--r--contrib/benchmark/collect.awk22
1 files changed, 13 insertions, 9 deletions
diff --git a/contrib/benchmark/collect.awk b/contrib/benchmark/collect.awk
index 3853936bd..12ece0ebf 100644
--- a/contrib/benchmark/collect.awk
+++ b/contrib/benchmark/collect.awk
@@ -27,21 +27,25 @@
# url <url> status <status> count <count> time_us <time_us>
{
if ($1 == "op") {
- op[$2]["count"] += $4;
- op[$2]["time_us"] += $6;
- op[$2]["time_us_sq"] += $6 * $6;
+ n = $4;
+ t = $6;
+ op[$2]["count"] += n;
+ op[$2]["time_us"] += t;
+ op[$2]["time_us_sq"] += n * (t/n) * (t/n);
} else if ($1 == "url") {
- url[$2][$4]["count"] += $6;
- url[$2][$4]["time_us"] += $8;
- url[$2][$4]["time_us_sq"] += $8 * $8;
+ n = $6;
+ t = $8;
+ url[$2][$4]["count"] += n;
+ url[$2][$4]["time_us"] += t;
+ url[$2][$4]["time_us_sq"] += n * (t/n) * (t/n);
}
}
-function avg(s, c) {
- if (c == 0) {
+function avg(sum, n) {
+ if (n == 0) {
return 0;
} else {
- return s / c;
+ return sum / n;
}
}