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
This commit is contained in:
Andrew Kryczka 2017-03-08 22:13:15 -08:00 committed by Facebook Github Bot
parent d43adf21bb
commit 5b11124e39
4 changed files with 12 additions and 9 deletions

View File

@ -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));

View File

@ -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 {

View File

@ -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();
}

View File

@ -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);
}
}