2 * Eddie Kohler, Yandong Mao, Robert Morris
3 * Copyright (c) 2012-2013 President and Fellows of Harvard College
4 * Copyright (c) 2012-2013 Massachusetts Institute of Technology
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, subject to the conditions
9 * listed in the Masstree LICENSE file. These conditions include: you must
10 * preserve this copyright notice, and you cannot mention the copyright
11 * holders in advertising related to the Software without their permission.
12 * The Software is provided WITHOUT ANY WARRANTY, EXPRESS OR IMPLIED. This
13 * notice is a summary of the Masstree LICENSE file; the license in that file
21 double min, max, sum, sumsq;
24 : min(-1), max(-1), sum(0), sumsq(0), count(0) {
27 if (!count || x < min)
35 typedef void (kvstats::*unspecified_bool_type)(double);
36 operator unspecified_bool_type() const {
37 return count ? &kvstats::add : 0;
39 void print_report(const char *name) const {
41 printf("%s: n %ld, total %.0f, average %.0f, min %.0f, max %.0f, stddev %.0f\n",
42 name, count, sum, sum / count, min, max,
43 sqrt((sumsq - sum * sum / count) / (count - 1)));