Re: random: Benchamrking fast_mix2
From: George Spelvin
Date: Sat Jun 14 2014 - 04:03:50 EST
> Want to give this patch a try on your collection of machines?
Not until I fix it to
+#if ADD_INTERRUPT_BENCH
+static unsigned long avg_cycles;
+
+#define AVG_SHIFT 8 /* Exponential average factor k=1/256 */
+#define FIXED_1_2 (1 << (AVG_SHIFT-1))
+
+static void add_interrupt_bench(cycles_t start)
+{
+ cycles_t duration = random_get_entropy() - start;
+
+ /* Use a weighted moving average */
+ avg_cycles += ((avg_cycles + FIXED_1_2) >> AVG_SHIFT) - duration;
+}
+#else
+#define add_interrupt_bench(x)
+#endif
+
... because the way you did it was just silly.
See net/ipv4/tcp_input.c:tcp_rtt_estimator().
That also shows you how to add a mean deviation estimator, too.
I'll go do that now...
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/