summaryrefslogtreecommitdiff
path: root/contrib/benchmark
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2018-09-24 19:33:43 +0200
committerFlorian Dold <florian.dold@gmail.com>2018-09-24 19:33:43 +0200
commitafbafd99c2b66bd3e35df763623883192cdad67d (patch)
treefadd038fbfba3e038cfbb4f848342106559a34ac /contrib/benchmark
parent11abc0ca801911ab584798d95f7c955933050226 (diff)
benchmark: throw in abs
Diffstat (limited to 'contrib/benchmark')
-rw-r--r--contrib/benchmark/collect.awk8
1 files changed, 7 insertions, 1 deletions
diff --git a/contrib/benchmark/collect.awk b/contrib/benchmark/collect.awk
index b91a978b6..159e4897a 100644
--- a/contrib/benchmark/collect.awk
+++ b/contrib/benchmark/collect.awk
@@ -25,6 +25,12 @@
# records are of the following forms:
# op <op> count <count> time_us <time_us>
# url <url> status <status> count <count> time_us <time_us>
+
+
+function abs(v) {
+ return v < 0 ? -v : v
+}
+
{
if ($1 == "op") {
n = $4;
@@ -57,7 +63,7 @@ function stdev(sum, sum_sq, n) {
if (n == 0) {
return 0;
} else {
- return sqrt( (sum_sq / n) - ( (sum / n) * (sum / n) ) );
+ return sqrt(abs((sum_sq / n) - ((sum / n) * (sum / n))));
}
}