benchutil: touch up measure.[ch]
Found these while using them on Linux.
Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/user/benchutil/include/benchutil/measure.h b/user/benchutil/include/benchutil/measure.h
index dcd8a10..d557e11 100644
--- a/user/benchutil/include/benchutil/measure.h
+++ b/user/benchutil/include/benchutil/measure.h
@@ -18,6 +18,8 @@
#pragma once
+#include <stdint.h>
+
__BEGIN_DECLS
struct sample_stats {
diff --git a/user/benchutil/measure.c b/user/benchutil/measure.c
index 85a5cda..299024b 100644
--- a/user/benchutil/measure.c
+++ b/user/benchutil/measure.c
@@ -10,10 +10,15 @@
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
+#include <string.h>
#include <sys/param.h>
+
#ifdef __ros__
-#include <parlib/tsc-compat.h>
-#include <benchutil/measure.h>
+ #include <parlib/tsc-compat.h>
+ #include <benchutil/measure.h>
+#else
+ /* you'll need to do find this manually on linux */
+ #include "measure.h"
#endif /* __ros__ */
/* Basic stats computation and printing.
@@ -83,7 +88,11 @@
for (int j = 0; j < nr_j; j++) {
if (stats->get_sample(data, i, j, &sample_time))
continue;
- /* var: (sum_i=1..n { (x_i - xbar)^2 }) / (n - 1) */
+ /* var: (sum_i=1..n { (x_i - xbar)^2 }) / (n - 1)
+ *
+ * for info on n vs n-1:
+ * https://stats.stackexchange.com/questions/17890/what-is-the-difference-between-n-and-n-1-in-calculating-population-variance
+ */
stats->var_time += (sample_time - stats->avg_time) *
(sample_time - stats->avg_time);
}