add max to histogram stats

Summary:
Domas enlightened me about p100 (i.e., max) stats. Let's add them to our histograms.
Closes https://github.com/facebook/rocksdb/pull/1968

Differential Revision: D4678716

Pulled By: ajkr

fbshipit-source-id: 65e7118
main
Andrew Kryczka 8 years ago committed by Facebook Github Bot
parent d43adf21bb
commit 5b11124e39
  1. 2
      db/db_test.cc
  2. 3
      include/rocksdb/statistics.h
  3. 5
      util/histogram.cc
  4. 11
      util/statistics.cc

@ -2158,7 +2158,7 @@ TEST_F(DBTest, GroupCommitTest) {
ASSERT_TRUE(!itr->Valid());
delete itr;
HistogramData hist_data = {0, 0, 0, 0, 0};
HistogramData hist_data;
options.statistics->histogramData(DB_WRITE, &hist_data);
ASSERT_GT(hist_data.average, 0.0);
} while (ChangeOptions(kSkipNoSeekToLast));

@ -411,6 +411,9 @@ struct HistogramData {
double percentile99;
double average;
double standard_deviation;
// zero-initialize new members since old Statistics::histogramData()
// implementations won't write them.
double max = 0.0;
};
enum StatsLevel {

@ -11,11 +11,13 @@
#define __STDC_FORMAT_MACROS
#endif
#include "util/histogram.h"
#include <inttypes.h>
#include <cassert>
#include <math.h>
#include <stdio.h>
#include "util/histogram.h"
#include "port/port.h"
namespace rocksdb {
@ -233,6 +235,7 @@ void HistogramStat::Data(HistogramData * const data) const {
data->median = Median();
data->percentile95 = Percentile(95);
data->percentile99 = Percentile(99);
data->max = max();
data->average = Average();
data->standard_deviation = StandardDeviation();
}

@ -200,13 +200,10 @@ std::string StatisticsImpl::ToString() const {
HistogramData hData;
histogramData(h.first, &hData);
snprintf(
buffer,
kBufferSize,
"%s statistics Percentiles :=> 50 : %f 95 : %f 99 : %f\n",
h.second.c_str(),
hData.median,
hData.percentile95,
hData.percentile99);
buffer, kBufferSize,
"%s statistics Percentiles :=> 50 : %f 95 : %f 99 : %f 100 : %f\n",
h.second.c_str(), hData.median, hData.percentile95,
hData.percentile99, hData.max);
res.append(buffer);
}
}

Loading…
Cancel
Save