benchmark: throw in abs
authorFlorian Dold <florian.dold@gmail.com>
Mon, 24 Sep 2018 17:33:43 +0000 (19:33 +0200)
committerFlorian Dold <florian.dold@gmail.com>
Mon, 24 Sep 2018 17:33:43 +0000 (19:33 +0200)
contrib/benchmark/collect.awk

index b91a978b6521f8e1359b9072bb26eab01eb097a9..159e4897af10720ab2c7a3f1d1be17a393ddb097 100644 (file)
 # 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))));
   }
 }